text stringlengths 3.09k 13.9k |
|---|
//! Update agent actor.
use super::{UpdateAgent, UpdateAgentState};
use crate::rpm_ostree::{self, Release};
use actix::prelude::*;
use failure::Error;
use log::trace;
use prometheus::IntGauge;
lazy_static::lazy_static! {
static ref LAST_REFRESH: IntGauge = register_int_gauge!(opts!(
"zincati_update_agent_... |
#[macro_use]
extern crate lazy_static;
use futures::StreamExt;
use prometheus::{
HistogramOpts, HistogramVec, IntCounter, IntCounterVec, IntGauge, Opts, Registry,
};
use rand::prelude::*;
use std::result::Result;
use std::time::Duration;
use warp::{ws::WebSocket, Filter, Rejection, Reply};
const ENVS: &'static [&'... |
use rand::{thread_rng, Rng};
use mpstthree::binary::struct_trait::{end::End, recv::Recv, send::Send, session::Session};
use mpstthree::functionmpst::fork::fork_mpst;
use mpstthree::meshedchannels::MeshedChannels;
use mpstthree::role::broadcast::RoleBroadcast;
use std::boxed::Box;
use std::error::Error;
use std::marke... |
/*
* Copyright 2019 Comcast Cable Communications Management, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicab... |
use config::Config;
use blob::Blob;
use futures::future;
use mime_guess::guess_mime_type;
use hyper::{self, Method, StatusCode};
use hyper::header::ContentType;
use hyper::server::{Http, Request, Response, Service, NewService};
use serde_json;
use std::collections::HashMap;
use std::fs::File;
use std::io::Read;
use s... |
use std::{cell::RefCell, collections::HashMap, fs::File, io::BufReader, rc::Rc};
use comfy_table::Table;
use futures::future::select_all;
use indicatif::{ProgressBar, ProgressStyle};
use crate::{
common::{PodSpecGroup, PodVer},
error::{PodError, Result},
opts::pod_helper::CheckOpts,
pod_http_client::P... |
use inwelling::*;
use proc_macro2::Span;
use std::collections::HashSet;
use std::{env, fs, path::PathBuf};
use syn::visit::Visit;
use syn::{ItemEnum, ItemStruct};
fn main() {
let mut optics_set = OpticsSet::new();
let mut optics_collector = OpticsCollector(&mut optics_set);
for section in inwelling(Opts ... |
use super::envelope::EnvelopGenerator;
use super::ApuChannel;
const DUTY_CYCLE_SEQUENCES: [[u8; 8]; 4] = [
[0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 1, 1, 1],
[0, 1, 1, 1, 1, 1, 1, 0],
];
pub struct PulseChannel {
sweep_period: u8,
sweep_current_time: u8,
sweep_in... |
//! Stream
use std::fmt::{self, Debug, Formatter};
use std::io::{self, Read, Write};
use mio::{Evented, Ready, Token};
use crate::errors::Result;
use crate::reactor::Reactor;
use crate::reactor::{EventedReactor, Reaction};
/// Anything that has a stream
pub trait StreamRef {
/// The Evented type for the Stream
... |
extern crate byteorder;
extern crate clap;
#[macro_use]
extern crate conrod;
extern crate find_folder;
extern crate gfx_core;
extern crate gfx_device_gl;
extern crate graphics;
extern crate image;
extern crate piston_window;
extern crate rand;
use image::Pixel;
use clap::{App, Arg};
use image::ImageBuffer;
use piston_... |
// Copyright (c) Facebook, Inc. and its affiliates.
// The individual bench implementations under bench/ inherits all uses from
// this file. Make common stuff available.
use anyhow::{anyhow, bail, Context, Result};
use log::{debug, error, info, trace, warn};
use serde::{Deserialize, Serialize};
use std::collections::... |
use super::lib;
use super::header;
use super::checksum;
use std::cmp;
// TCP
//
// This module contains a TCP header definition.
//
// TCP - struct for TCP headers
// Header<TCP>.src_port() -> u16 - get source port
// Header<TCP>.set_src_port(u16) - set source port
// Header<TCP>.dst_port() -> u1... |
use std::{collections::HashSet, net::SocketAddr, string::String, time::Duration};
use zebra_chain::parameters::Network;
use crate::BoxError;
/// The number of times Zebra will retry each initial peer, before checking if
/// any other initial peers have returned addresses.
const MAX_SINGLE_PEER_RETRIES: usize = 2;
/... |
use asn1::{Tag, Integer, OctetString, ASN1, to_der, GeneralString, SInteger};
use error::{KerlabResult};
use base::{KerberosTime, PrincipalName, Realm};
use yasna::{DERWriter, BERReader};
use chrono::{Utc};
use encryption::{EncryptionKey, KeyUsage};
use checksum::{Checksum, kerberos_hmac_md5};
use std::str::FromStr;
#... |
use crate::{
BufReader, EventReader, File, HashMap, OptsBuilder, Path, Pool, PooledConn, Regex, Row,
XmlEvent,
};
// use std::any::Any;
#[derive(Clone, Debug, Default)]
pub struct XNode {
namespace: String,
id: String,
param_type: String,
res_type: String,
pub sql: String,
params: Vec<S... |
use crate::ast;
use crate::error::{GraphError, Result};
use crate::graph::{ToValues, Values, Variables};
use inflector::Inflector;
#[derive(Clone, Default, Debug)]
pub struct Vars {
pub inner: Variables,
}
#[derive(Clone)]
pub struct Query<'a> {
pub name: &'a str,
pub description: &'a str,
pub ty: as... |
//
//! Copyright 2020 Alibaba Group Holding Limited.
//!
//! Licensed under the Apache License, Version 2.0 (the "License");
//! you may not use this file except in compliance with the License.
//! You may obtain a copy of the License at
//!
//! http://www.apache.org/licenses/LICENSE-2.0
//!
//! Unless required ... |
pub(crate) fn f32_to_bf16(value: f32) -> u16 {
// Convert to raw bytes
let x = value.to_bits();
// check for NaN
if x & 0x7FFF_FFFFu32 > 0x7F80_0000u32 {
// Keep high part of current mantissa but also set most significiant mantissa bit
return ((x >> 16) | 0x0040u32) as u16;
}
/... |
use graphene::color::Color;
use graphene::layers::style;
use graphene::layers::style::Fill;
use graphene::layers::style::Stroke;
use graphene::Operation;
use graphene::Quad;
use glam::{DAffine2, DVec2};
use serde::{Deserialize, Serialize};
use crate::input::{mouse::ViewportPosition, InputPreprocessor};
use crate::too... |
//! Defines common traits for methods that attempt to share components.
use crate::{
analysis::{GraphColoring, ScheduleConflicts},
ir,
};
use ir::{
traversal::{Action, VisResult, Visitor},
CloneName, RRC,
};
use itertools::Itertools;
use std::collections::HashMap;
/// A trait for implementing passes th... |
use std::path::PathBuf;
use crate::graphics;
use crate::graphics::mode::PolygonMode;
use crate::input::{keyboard, mouse};
use crate::math::Vec2;
use crate::shader;
use crate::timer;
use futures::executor::block_on;
use graphics::prelude::*;
use winit::{event::*, event_loop::EventLoop, window::WindowBuilder};
/// A cu... |
use bevy_ecs::prelude::{Bundle, Component, ReflectComponent};
use bevy_math::{Mat4, Vec4};
use bevy_reflect::Reflect;
use bevy_render::{
camera::{Camera, CameraProjection, DepthCalculation},
primitives::Frustum,
view::VisibleEntities,
};
use bevy_transform::components::{GlobalTransform, Transform};
// most... |
// Copyright (c) 2021 FZI Forschungszentrum Informatik
// SPDX-License-Identifier: Apache-2.0
//! Parsers for modules and related items
use std::sync::Arc;
use nom::branch::alt;
use nom::character::complete::char as chr;
use nom::combinator::{iterator, map, value};
use nom::multi::many0;
use nom::sequence::tuple;
us... |
use chrono::Utc;
use htmlescape::encode_minimal;
use scraper::{ElementRef, Html, Selector};
use std::env;
use std::fs::File;
use std::io::Write;
#[derive(Debug)]
struct Notice {
index: i32,
title: String,
author: String,
category: String,
link: String,
published_at: String,
}
fn fetch_html(bas... |
use clap::ArgMatches;
use hyper::rt::{self, Future, Stream};
use hyper::{self, service::service_fn, Body, Request, Response, Server};
use reqwest::{Client, Url};
use serde_json;
use std::{env::var, thread, time::Duration};
use commands::shared::*;
use error::Result;
use models::emoticon::Emoticon;
lazy_static! {
sta... |
// This file is part of https://github.com/SpringQL/SpringQL which is licensed under MIT OR Apache-2.0. See file LICENSE-MIT or LICENSE-APACHE for full license details.
//! Pipeline is the most important structural view of stream processing, similar to RDBMS's ER-diagram.
//!
//! Nodes are streams and edges are one of... |
use warp::Filter;
use std::sync::Arc;
use juniper::http::graphiql::graphiql_source;
use juniper::RootNode;
use tokio_postgres::Client;
use std::convert::Infallible;
use juniper::http::GraphQLRequest;
use tokio_postgres::NoTls;
struct QueryRoot;
struct MutationRoot;
// Make the struct work with Juniper
#[derive(junipe... |
use std::collections::{BTreeMap, VecDeque};
use std::rc::Rc;
use std::time::Duration;
use super::parser::ast::VectorSelector;
use super::sample::{Cursor, Sample};
use super::value::{InstantVector, QueryValue, QueryValueIter, QueryValueKind, RangeVector};
use crate::model::{Labels, LabelsTrait, SampleValue, Timestamp, ... |
use std::collections::HashMap;
use std::io::Write;
use std::os::raw::c_uchar;
use std::process;
use mustache;
use mustache::MapBuilder;
use client::ClientW;
use config::Config;
use util;
use workspace::Workspace;
pub struct LoggerConfig {
client_template: mustache::Template,
client_selected_template: mustache... |
use std::fmt::Display;
use std::io::stdout;
use std::path::Path;
use blake2b_simd::Params;
use log::debug;
use rand::{thread_rng, Rng};
use serde::Serialize;
use crate::nodeclient::leaderlog::libsodium::{
sodium_crypto_vrf_proof_to_hash, sodium_crypto_vrf_prove, sodium_crypto_vrf_verify,
};
use crate::nodeclient:... |
use crate::table::CompressionTable;
use crate::FSE_MAX_TABLELOG;
use bitstream::BitCstream;
use bitstream::BitCstreamOwned;
use bitstream::BIT_CONTAINER_BYTES;
use bitstream::NUM_BITS_IN_BIT_CONTAINER;
#[derive(Debug)]
struct FseCState {
value: usize,
}
impl FseCState {
fn new(symbol: u8, comp: &CompressionTa... |
use futures::Future;
use rusoto_core::{ProvideAwsCredentials, Region};
use rusoto_core::credential::{AwsCredentials, EnvironmentProvider};
use rusoto_s3::{S3Client, PutObjectRequest,
DeleteObjectRequest, DeleteObjectOutput, DeleteObjectError};
use rusoto_s3::util::PreSignedRequest;
pub struct S3Access ... |
use super::*;
pub struct TcpWarpServer {
listen_address: SocketAddr,
connect_address: IpAddr,
}
impl TcpWarpServer {
pub fn new(listen_address: SocketAddr, connect_address: IpAddr) -> Self {
Self {
listen_address,
connect_address,
}
}
pub async fn listen(&s... |
// Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{
code_cache::{
module_cache::{ModuleCache, TransactionModuleCache},
script_cache::ScriptCache,
},
loaded_data::function::{FunctionRef, FunctionReference},
process_txn::{execute::ExecutedTrans... |
use std::process::Command;
use crate::{XResult, util_msg, util_cmd};
const LANG: &str = "LANG";
const EN_US: &str = "en_US";
#[derive(Default, Debug, Clone)]
pub struct GitStatusChange {
pub added: Vec<String>,
pub modified: Vec<String>,
pub renamed: Vec<(String, String)>,
pub deleted: Vec<String>,
... |
//! A GUI framework module providing MFC-like API.
// Copyright © 2021 RICOS
// Apache license 2.0
use instant::Instant;
use std::sync::Arc;
use std::time::Duration;
use winit::dpi::*;
use winit::event::*;
use winit::event_loop::ControlFlow;
use winit::window::Window;
/// The framework of applications with `winit`.
... |
// SPDX-License-Identifier: MIT
// Copyright (c) 2022 <NAME> <https://github.com/AndrielFR>
use crate::models::Character;
use crate::models::Date;
use crate::models::Gender;
use crate::models::Image;
use crate::models::Language;
use crate::models::Name;
use crate::Result;
#[derive(Debug, Default, Clone, PartialEq)]
... |
// Copyright 2020 Google LLC
//
// Use of this source code is governed by an MIT-style license that can be found
// in the LICENSE file or at https://opensource.org/licenses/MIT.
//! A handler and associated types for the filesystems action.
//!
//! The filesystems action lists all mounted filesystems on the client,
/... |
use getopt_rs::getopt;
use std::{
collections::HashMap,
env,
io::{self, Write},
process::exit,
};
#[derive(Debug, PartialEq)]
enum Token {
Operator(char),
Number(f64),
}
#[derive(Debug)]
struct Error(pub String);
const PRECEDENCE: [(char, usize); 5] = [('+', 0), ('-', 0), ('*', 1), ('/', 1), (... |
use {bincode, future, num_cpus};
use future::server::{Response, Shutdown};
use futures::{Future, future as futures};
use futures::sync::oneshot;
#[cfg(feature = "tls")]
use native_tls_inner::TlsAcceptor;
use serde::Serialize;
use serde::de::DeserializeOwned;
use std::fmt;
use std::io;
use std::net::SocketAddr;
use std:... |
extern crate evdev;
extern crate nix;
use evdev::uinput::{VirtualDevice, VirtualDeviceBuilder};
use evdev::{AttributeSet, Device, Key, RelativeAxisType};
use nix::sys::inotify::{AddWatchFlags, InitFlags, Inotify};
use std::collections::HashMap;
use std::error::Error;
use std::fs::read_dir;
use std::os::unix::ffi::OsSt... |
use crate::{
errors::CompileError,
token::{Token, TokenType},
};
use std::{str::Chars, str::FromStr};
use peekmore::{PeekMore, PeekMoreIterator};
pub struct Scanner<'s> {
pub source_raw: &'s str,
source: PeekMoreIterator<Chars<'s>>,
tokens: Vec<Token>,
start: usize,
current: usize,
}
imp... |
#![warn(clippy::all, clippy::pedantic, clippy::nursery)]
#![allow(clippy::default_trait_access)]
use bigdecimal::*;
use chrono::prelude::*;
use phonenumber::*;
use serde::*;
use std::{path::*, str::FromStr};
use structopt::*;
use tokio::stream::*;
use url::Url;
use yandex_money::*;
#[derive(Clone, Debug, Serialize, D... |
//pub mod level {
pub enum Direction {
Up, Down, Left, Right
}
fn move_in_dir(x: i32, y: i32, dir: Direction) -> (i32,i32) {
return match dir {
Direction::Up => (x,y-1),
Direction::Down => (x,y+1),
Direction::Left => (x-1,y),
Direction::Ri... |
// Copyright Rivtower Technologies LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed ... |
/*
* Copyright (C) 2013 <NAME> <<EMAIL>>
* Copyright (c) 2016
* <NAME> <<EMAIL>>
* <NAME> <<EMAIL>>
*
* Permission is hereby granted, free of charge, to any
* person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the
* Software without restri... |
extern crate crossbeam;
use std::sync::{Arc, Mutex};
use super::super::activity_wrapper::ActivityWrapperTrait;
use crate::activity_identifier::ActivityIdentifier;
use crate::implementation::event_queue::EventQueue;
use crate::{activity, ConstellationTrait, Event};
use crossbeam::{Receiver, Sender};
use hashbrown::Ha... |
use std::io;
use std::io::prelude::*;
use std::num::ParseIntError;
use std::str::FromStr;
use std::collections::HashMap;
pub fn solve(input: impl BufRead, part: u8) -> io::Result<()> {
let input = parse(input);
let solution = match part {
1 => part_1(input),
2 => part_2(input),
_ => u... |
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
use crate::{
driver::timer,
operation as ops,
scenario::{self, Scenario},
timer::Timer,
Checkpoints, Result, Trace,
};
use std::{
collections::BTreeMap,
future::Future,
net::Sock... |
#![allow(clippy::unreadable_literal, clippy::inconsistent_digit_grouping)]
// i use ugly binary digit grouping to represent the RTP header fields
use crate::rtp::RtpHeader;
pub struct RtpJitterInStream {
first_header: RtpHeader,
pub channels: u16,
pub audio_slices: Vec<(Vec<u8>, u16, u32)>,
ended: boo... |
// Copyright (c) 2018 <NAME>, RWTH Aachen University
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed exc... |
//! DO NOT USE THIS CRATE DIRECTLY.
//! It is an internal dependency of macro crates.
//!
//! Utility functions for parsing fragstrings macros arguments.
pub mod punct {
use itertools::Itertools;
use proc_macro2::{TokenStream, TokenTree};
pub fn parse_punctuated_args(args: TokenStream) -> Vec<TokenStream>... |
//! Chapter9 - Intro to Activation Functions - Modeling Probabilities.ipynb
//!
//! https://github.com/iamtrask/Grokking-Deep-Learning/blob/master/Chapter9%20-%20Intro%20to%20Activation%20Functions%20-%20Modeling%20Probabilities.ipynb
use std::error::Error;
use std::ops::Mul;
use datasets::image::mnist;
use indicatif... |
use std;
use std::error::Error;
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum RedirectType { Input, Output, Append }
#[derive(Debug)]
pub struct Redirect<'a> {
pub target: &'a [u8],
pub from: i32,
pub typ: RedirectType,
}
#[derive(Debug)]
pub struct Command<'a> {
pub name: &'a [u8],
pub arguments: Vec<&... |
#![feature(test)]
#![feature(map_first_last)]
#![feature(bool_to_option)]
#[cfg(not(target_arch = "wasm32"))]
mod target_arch {
pub use rayon::prelude::*;
pub use std::io::Write;
pub use std::sync::atomic::AtomicUsize;
pub use std::sync::atomic::Ordering;
pub use std::sync::Arc;
pub use std::ti... |
use super::*;
use crate::bytecode::profile::ResultsTag;
use mathic::*;
pub struct MulGenerator {
scratch_gpr: Reg,
left_fpr: FPReg,
right_fpr: FPReg,
result: Reg,
left: Reg,
right: Reg,
}
impl BinaryMathICGenerator for MulGenerator {
fn new(
result: Reg,
left: Reg,
r... |
use std::collections::{BTreeMap, BTreeSet};
use std::ffi::OsStr;
use std::io::{self, Write};
use std::path::PathBuf;
use std::process::{Command, exit, Stdio};
use std::time::{Duration};
use anyhow::{Context, Result};
use clap::{crate_description, crate_name, crate_version, value_t_or_exit, Arg, App};
use bkt::{Comman... |
extern crate regex;
#[macro_use]
extern crate lazy_static;
use std::collections::HashMap;
use regex::{Regex, Match};
/// colorizes the strings, giving you the ability to customize
/// some of the colorization process.
pub struct Colorize {
/// maps a color string to the code for that color.
colors: HashMap<&'... |
// ---------------------------------------------------------------------------
// Copyright: (c) 2022 ff. <NAME> (<EMAIL>)
// License: This program is part of a larger application. For license
// details please read the file LICENSE.TXT provided together
// with the application.
// -----... |
///! Characteristics of a mon.
use super::rng::Rng;
use num_derive::{FromPrimitive, ToPrimitive};
use std::fmt;
use wasm_bindgen::prelude::*;
/// Individual Values for a mon's stats.
#[wasm_bindgen]
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
pub struct IVs(pub u32, pub u32, pub u32, pub u32, pub u32, pub u32);
impl... |
use core::marker::PhantomData;
use core::mem;
use core::ptr;
use core::sync::atomic::{AtomicPtr, AtomicU32};
use core::sync::atomic::Ordering::{Acquire, Relaxed, Release};
use core::u32;
use crate::block::{Block, Layout};
use crate::alloc::{Heap, HeapError};
/// Allocator for a hunk of memory partitioned into fixed si... |
use actix_web::web::{Data, Json, ServiceConfig};
use shared::{
api::{endpoints::locale, ApiEndpoint},
domain::locale::{Bundle, ItemKind, ListBundleResponse, ListItemKindResponse},
};
use sqlx::PgPool;
use crate::error;
async fn list_bundles(db: Data<PgPool>) -> Result<Json<ListBundleResponse>, error::Server> ... |
use once_cell::unsync::Lazy;
use crate::{
canvas::Canvas,
input::{InputEvent, InputMouseEvent, Keys},
log,
tree::Tree,
widget::Component,
widget::Widget,
FloatingWindow, Settings,
};
pub struct InternalUi {
pub tree: Tree,
pub floating_window: FloatingWindow,
pub canvas: Canvas... |
use std::collections::vec_deque::VecDeque;
use std::collections::HashMap;
use std::mem;
use std::any::{TypeId, Any};
use std::fmt::Debug;
use std::rc::Rc;
use std::cell::RefCell;
pub mod types;
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
pub struct EventName(pub &'static str);
// link: https... |
use std::collections::HashSet;
fn main() {
// const INPUT: &str = "v...>>.vv>
// .vv>>.vv..
// >>.>v>...v
// >>v>>.>.v.
// v>v.vv.v..
// >.>>..v...
// .vv..>.>v.
// v.v..>>v.v
// ....v..v.>";
const INPUT: &str = include_str!("../inputs/25.txt");
let mut grid = parse_cucumbers(&INPUT);
println!("Initia... |
use std::collections::{HashMap, HashSet};
use std::fs;
use std::net::TcpStream;
use std::path::Path;
use base64;
use chrono::Utc;
use mysql::prelude::*;
use mysql::*;
use native_tls::{TlsConnector, TlsStream};
use imap;
use imap_proto::types::SectionPath;
use regex::Regex;
use serde_xml_rs::from_reader;
use toml;
mod... |
extern crate pkg_config;
use std::collections::HashSet;
use std::env;
use std::path::PathBuf;
use std::process::Command;
const MIN_VERSION: &str = "1.1.2";
const MAX_VERSION: &str = "1.2.0";
fn main() {
if cfg!(target_os = "freebsd") {
env_var_set_default("OPENCC_INCLUDE_DIRS", "/usr/include/opencc");
... |
extern crate rand;
struct Display {
pixels: [[bool; 64]; 32],
}
struct Input {
keys: [bool; 16],
}
struct Cpu {
display: Display,
input: Input,
dm: DataMemory,
R: [u8; 16],
RSoundTimer: u8,
RDelayTimer: u8,
PC: usize,
SP: usize,
VX: usize,
VY: usize,
I: usize,
}
struct DataMemory {
stack... |
use std::error::Error;
use std::collections::VecDeque;
use log;
use scraper::Html;
use scraper::ElementRef;
use scraper::Selector;
use lazy_static::lazy_static;
use crate::model::Comment;
use crate::error::HnError;
use crate::model::Id;
use crate::parser;
use crate::parser::HtmlParse;
const COMMENT_INDENT_INCR: u32 = ... |
//! Advent of Code - Day 3 "Spiral Memory" Solution
use error::Result;
use std::collections::HashMap;
use std::convert::TryFrom;
use std::io::BufRead;
/// Parse the file at `filename` and generate the checksum.
pub fn find_solution<T: BufRead>(reader: T, second_star: bool) -> Result<u32> {
let mut checksum = 0;
... |
use crate::prelude::*;
use crate::{
gradient_shader, scalar, Color, ColorFilter, Image, Matrix, NativeFlattenable, Point, TileMode,
};
use skia_bindings::{
C_SkShader_Deserialize, C_SkShader_asAGradient, C_SkShader_isAImage,
C_SkShader_makeWithColorFilter, C_SkShader_makeWithLocalMatrix, SkFlattenable, SkRe... |
//! Synchronous interactions as a request message to a sequence of response messages
use std::collections::hash_map::DefaultHasher;
use std::collections::HashMap;
use std::fmt::{Display, Formatter};
use std::hash::{Hash, Hasher};
use std::sync::{Arc, Mutex};
use itertools::Itertools;
use serde_json::{json, Value};
u... |
//! Tabbed views.
use std::fmt::Debug;
use std::iter;
use crossterm::event::KeyCode;
use crossterm::event::MouseButton;
use crossterm::event::MouseEvent;
use crossterm::event::MouseEventKind;
use tui::text::Span;
use tui::text::Spans;
use tui::text::Text;
use tui::widgets::Paragraph;
use tui::widgets::Widget;
use c... |
//! The implementation for #[derive(Keyable)]
use crate::attr::{FieldKind, Fields};
use proc_macro2::Ident;
use quote::{quote, quote_spanned};
use syn::{spanned::Spanned, Data, DataStruct};
static DERIVED_MIRROR_STRUCT_PREFIX: &str = "KeyableDerivedMirrorOf_";
pub(crate) fn derive_keyable_impl(
input: syn::Deri... |
use std::collections::HashMap;
use std::ops::RangeToInclusive;
type ParserResult<T> = Result<T, ParserError>;
pub struct ParsedArgs {
options: HashMap<String, String>,
}
impl ParsedArgs {
/// Parses linear argument iterator to create an instance of `ParsedArgs`.
pub fn from_iter<I, S>(arg_list: I) -> Sel... |
#![cfg_attr(not(feature = "std"), no_std)]
use frame_support::{
dispatch::DispatchResult, ensure, pallet_prelude::*, sp_std::convert::TryInto,
sp_std::prelude::*, sp_std::str, traits::Time,
};
use frame_system::pallet_prelude::*;
pub use pallet::*;
pub const E9: u64 = 1_000_000_000;
pub const E18: u128 = 1_00... |
// large parts directly stolen from macroquad: https://github.com/not-fl3/macroquad/blob/854aa50302a00ce590d505e28c9ecc42ae24be58/src/file.rs
use std::{collections::HashMap, io, path};
use std::sync::{Arc, Mutex};
use crate::{conf::Conf, Context, GameError, GameResult};
use std::panic::panic_any;
use crate::GameError... |
use bevy::prelude::*;
use crate::{food::FoodEatenEvent, Dude, sounds, level, level_over, game_controller, dude};
#[derive(Component)]
pub struct ContinueText;
pub struct Score {
pub total: usize,
pub total_bonus: usize,
pub current_level: usize,
pub current_level_bonus: usize,
pub current_death_cou... |
use std::convert::{TryFrom, TryInto};
#[cfg_attr(docsrs, doc(cfg(feature = "numeric")))]
impl crate::ToSql for bigdecimal::BigDecimal {
fn ty(&self) -> crate::pq::Type {
crate::pq::types::NUMERIC
}
/*
* https://github.com/postgres/postgres/blob/REL_12_0/src/backend/utils/adt/numeric.c#L655
... |
//-----------------------------------------------------
// Setup.
use aoc::Day;
use std::iter::FromIterator;
static INPUT: &str = include_str!("data/q19.data");
#[derive(Clone, Debug, PartialEq)]
enum Cell {
Empty,
Vertical,
Horizontal,
Both,
Letter(char),
}
#[derive(Debug, PartialEq)]
enum Dir... |
#![allow(non_camel_case_types, non_snake_case, unused)]
//! Smart & safe rustified WinAPI IUnknown counterpart.
//!
use std::cell::Cell;
use std::convert::{TryFrom, TryInto};
use std::error::Error;
use winapi::shared::guiddef::{IID_NULL, REFIID};
use winapi::shared::minwindef::{LPVOID, PUINT, UINT, WORD};
use winapi... |
use super::{HasFlag, Mode};
use std::{
fmt::{self, Write},
fs::Metadata,
os::unix::fs::MetadataExt,
};
const S_IFMT: u32 = 0xf000;
const S_IFIFO: u32 = 0x1000;
const S_IFCHR: u32 = 0x2000;
const S_IFDIR: u32 = 0x4000;
const S_IFBLK: u32 = 0x6000;
const S_IFREG: u32 = 0x8000;
const S_IFLNK: u32 = 0xa000;
co... |
//! Convert simple data from Rust to Julia.
//!
//! In order to use data from Rust in Julia, it must first be converted to a [`Value`]. The
//! easiest way to do this is by using [`Value::new`], which is compatible with types that
//! implement the [`IntoJulia`] trait defined in this module. This trait only supports bi... |
// Copyright (c) 2020 <NAME>
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
use crate::error::ErrorKind;
use std::fmt::{self, Display, Formatter};
use std::str::FromStr;
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum Type {
String,
Bool,
Int16,
Int... |
//! See the [parent crate documentation](https://docs.rs/serde_piecewise_default/) for more information.
#![recursion_limit="512"]
extern crate proc_macro;
extern crate proc_macro2;
#[macro_use]
extern crate quote;
extern crate syn;
extern crate serde;
use crate::proc_macro::TokenStream as RustTS;
use crate::proc_mac... |
use crate::prelude::*;
pub struct ExprIter<'a> {
stack: Vec<&'a Expr>,
}
impl<'a> Iterator for ExprIter<'a> {
type Item = &'a Expr;
fn next(&mut self) -> Option<Self::Item> {
self.stack.pop().map(|current_expr| {
use Expr::*;
let mut push = |e: &'a Expr| self.stack.push(e)... |
use chrono::{Datelike, Utc};
use std::error::Error;
use std::fs;
use std::fs::File;
use structopt::StructOpt;
use std::path::{Path, PathBuf};
use tokio::io::AsyncWriteExt;
use log::{debug, error, info};
use simplelog::*;
use reqwest::Client;
use walkdir::WalkDir;
mod data_structures;
mod reporting;
mod extraction;
... |
extern crate examples_common;
extern crate forester;
extern crate image;
extern crate rand;
use std::f64::consts::PI;
use std::fs::File;
use rand::{thread_rng, Rng};
use forester::categorical::CatCount;
use forester::criterion::GiniCriterion;
use forester::data::{SampleDescription, TrainingData};
use forester::dfore... |
use decent_synquote_alternative as synquote;
use proc_macro2::{Ident, Span};
use synquote::parser::*;
use synquote::token_builder::*;
use crate::structs_and_enums::CreateWrapperMutatorParams;
use crate::structs_and_enums::{FieldMutator, FieldMutatorKind};
use crate::Common;
use crate::MakeMutatorSettings;
#[allow(no... |
// Copyright (c) The Dijets Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{error::Error, storage::StorageWrapper};
use dijets_config::config;
use dijets_types::chain_id::{self, ChainId};
use serde::{Deserialize, Serialize};
use std::path::{Path, PathBuf};
use structopt::StructOpt;
/// A config f... |
/*
* Copyright 2019 The Starlark in Rust Authors.
* Copyright (c) Facebook, Inc. and its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/lic... |
use crate::aabb::AxisAlignedBB;
use crate::BoundingVolume;
use bevy::{
prelude::*,
render::{mesh::VertexAttributeValues, pipeline::PrimitiveTopology},
};
use core::panic;
use std::f32::consts::PI;
/// Defines a bounding box, oriented to minimize the bounded volume. This bounding box is expensive
/// to compute... |
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless ... |
use env_logger::Env;
use error::Error;
use operation::OperationalMessage;
use structopt::StructOpt;
extern crate notify;
use log;
use std::sync::mpsc::{channel, Sender};
use std::{env, thread};
use crate::context::Context;
use crate::database::{Database, DatabaseOperation};
use crate::local::{LocalSync, LocalWatcher}... |
pub mod entity;
pub use entity::*;
pub mod hierarchy;
pub use hierarchy::*;
pub mod storage;
pub use storage::*;
pub mod style;
pub use style::*;
pub mod transform;
pub use transform::*;
pub mod animator;
pub use animator::*;
pub mod mouse;
pub use mouse::*;
pub mod resource;
pub use resource::*;
pub use crate:... |
use dates::Date;
use math::interpolation::Interpolable;
use std::cmp::Ordering;
use std::ops::Add;
use std::ops::AddAssign;
use std::fmt::Display;
use std::fmt;
/// We define some commonly used times of day. These map to different amounts
/// of volatility day_fraction depending on the exchange etc.
///
/// Strictly s... |
//! A collection of endpoints that validates the HTTP method.
use {
crate::{
endpoint::{
Endpoint,
IsEndpoint,
Oneshot,
OneshotAction,
PreflightContext, //
},
error::Error,
},
http::Method,
std::ops::{BitOr, BitOrAssign... |
#![recursion_limit = "512"]
use log::info;
use rand::Rng;
use std::time::Duration;
use yew::services::{IntervalService, Task};
use yew::{html, Component, ComponentLink, Html, ShouldRender};
#[derive(Clone, Copy, PartialEq)]
enum LifeState {
Alive,
Dead,
}
#[derive(Clone, Copy)]
struct Cellule {
life_stat... |
//! The check_expirations module owns the 'check-repo-expirations' subcommand and provide methods for
//! checking the metadata expirations of a given TUF repository.
use crate::repo::{error as repo_error, repo_urls};
use crate::Args;
use chrono::{DateTime, Utc};
use log::{error, info, trace, warn};
use parse_datetime... |
/// This is the parser and interpreter for the 'Foo' language. See `tutorial.md` in the repository's root to learn
/// about it.
use chumsky::prelude::*;
#[derive(Debug)]
enum Expr {
Num(f64),
Var(String),
Neg(Box<Expr>),
Add(Box<Expr>, Box<Expr>),
Sub(Box<Expr>, Box<Expr>),
Mul(Box<Expr>, Box... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.