text stringlengths 8 4.13M |
|---|
use std::collections::HashMap;
use scraper::selector;
use scraper::{Html, Selector};
use crate::{
api::{ElementRef, ElementRefExt},
Error, NoneErrorExt, Result,
};
#[derive(Debug, PartialEq)]
pub enum UpcomingMatchTeam {
Name(String),
Tbd(String),
}
impl UpcomingMatchTeam {
// TODO: doc
pub ... |
use crate::{
encryption::ElGamal,
helper::Helper,
types::{Cipher, ModuloOperations, PublicKey},
};
use num_bigint::BigUint;
use num_traits::One;
#[cfg(feature = "std")]
use serde::{Deserialize, Serialize};
#[derive(Clone, Eq, PartialEq, Debug, Hash)]
#[cfg_attr(feature = "std", derive(Serialize, Deseriali... |
fn main() {
// In general, the `{}` will be automatically replaced with any
// arguments. These will be stringified.
println!("{} days", 31);
// Positional arguments can be used. Specifying an integer inside `{}`
// determines which additional argument will be replaced. Arguments start
// at 0 immediately ... |
#[doc = r" Value read from the register"]
pub struct R {
bits: u32,
}
#[doc = r" Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::SLVCTL {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mu... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[cfg(feature = "Win32_Media_Audio_Apo")]
pub mod Apo;
#[cfg(feature = "Win32_Media_Audio_DirectMusic")]
pub mod DirectMusic;
#[cfg(feature = "Win32_Media_Audio_DirectSound")]
pub mod DirectS... |
#![feature(proc_macro_hygiene, decl_macro)]
extern crate rocket;
extern crate rocket_contrib;
extern crate dotenv;
use rocket_contrib::templates::Template;
use frontend;
fn main() {
dotenv::dotenv();
std::process::Command::new("rm")
.arg("./cache/*")
.status()
.unwrap(); // clears th... |
use crate::*;
impl<'t> Package<'t> {
pub fn insintric_gcd(&self) -> ItemId {
self.bodies.iter().find(|(_, body)| body.attributes.lang && body.name == "__insintric_gcd").map(|e| *e.0).unwrap()
}
pub fn insintric_lcm(&self) -> ItemId {
self.bodies.iter().find(|(_, body)| body.attributes.lang... |
use crate::headers::{Error, Header, HeaderName, HeaderValue};
use hyper::http::{header, Uri};
use std::iter;
static LOCATION: &HeaderName = &header::LOCATION;
#[derive(Clone, Debug, PartialEq)]
pub struct Location(Uri);
impl Location {
pub fn uri(&self) -> &Uri {
&self.0
}
}
impl Header for Location... |
// auto generated, do not modify.
// created: Mon Feb 22 23:57:02 2016
// src-file: /QtWidgets/qabstractitemview.h
// dst-file: /src/widgets/qabstractitemview.rs
//
// header block begin =>
#![feature(libc)]
#![feature(core)]
#![feature(collections)]
extern crate libc;
use self::libc::*;
// <= header block end
// m... |
use std::fs;
#[derive(Debug)]
struct Files(String, String);
fn main() {
// paths mengembalikan iterator dari std::fs:DirEntry
let paths = fs::read_dir(r#"/run/media/susilo/381ed80f-3b52-4756-8881-9b77edc118ca/Backup Phone/susilo/DCIM/Camera"#).unwrap();
let f = vec![
String::from("/run/me... |
use crate::sim::*;
pub struct NaiveBinarySearch {
lo: usize,
hi: usize,
memory: Memory,
}
struct Retry {
commit: usize,
remaining_retries: usize,
}
enum Memory {
PreviousLows(Vec<usize>),
Retry {
max_retries: usize,
active_retry: Option<Retry>,
},
BlissfulIgnorance... |
/// The current state of the keyboard modifiers.
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct ModifiersState {
/// Whether a shift key is pressed
pub shift: bool,
/// Whether a control key is pressed
pub control: bool,
/// Whether an alt key is pressed
pub alt: bool,
/// Whether a ... |
#[doc = "Reader of register C12BNDTR"]
pub type R = crate::R<u32, super::C12BNDTR>;
#[doc = "Writer for register C12BNDTR"]
pub type W = crate::W<u32, super::C12BNDTR>;
#[doc = "Register C12BNDTR `reset()`'s with value 0"]
impl crate::ResetValue for super::C12BNDTR {
type Type = u32;
#[inline(always)]
fn re... |
//! Tests auto-converted from "sass-spec/spec/libsass/error-directive-nested"
#[allow(unused)]
use super::rsass;
#[allow(unused)]
use rsass::precision;
// Ignoring "function", tests with expected error not implemented yet.
// Ignoring "inline", tests with expected error not implemented yet.
// Ignoring "mixin", test... |
// Copyright 2017 CoreOS, Inc.
//
// 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 to in... |
use crate::{bed::BedDataLine, bedgraph::BedGraphDataLine, util::Strand};
use num::Float;
use std::{
fs::{File, OpenOptions},
io::{BufWriter, Write},
};
pub struct BedWriter {
path: String,
writer: BufWriter<File>,
num_lines_written: i64,
}
impl BedWriter {
pub fn new(path: &str) -> Result<Self... |
mod with_small_integer_time;
use proptest::strategy::Just;
use proptest::{prop_assert, prop_assert_eq};
use liblumen_alloc::erts::term::prelude::*;
use liblumen_alloc::erts::time::Milliseconds;
use crate::erlang;
use crate::erlang::start_timer_3::result;
use crate::test;
use crate::test::strategy::milliseconds;
use ... |
use super::Value;
use crate::{BitVec, Set};
use serde::{Deserialize, Serialize};
use std::{
convert::TryInto,
fmt::{self, Display},
slice::Iter as SliceIter,
};
// `u8` mostly for compatibility with dynasm
#[derive(
Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, Debug, Defau... |
use proc_macro2::*;
use syn;
use meta::*;
use util::*;
pub fn derive(mut item: syn::DeriveInput) -> Result<TokenStream, Diagnostic> {
let flags =
MetaItem::with_name(&item.attrs, "diesel").unwrap_or_else(|| MetaItem::empty("diesel"));
let struct_ty = ty_for_foreign_derive(&item, &flags)?;
{
... |
use crate::{consts, get_last_digit, Sudoku};
#[cfg(all(feature = "alloc", not(feature = "std")))]
use alloc::vec::Vec;
#[cfg(all(feature = "smallvec", feature = "alloc"))]
type SudokuBackTrackingVec = smallvec::SmallVec<[Sudoku; 10]>;
#[cfg(all(not(feature = "smallvec"), feature = "alloc"))]
type SudokuBackTrackingVe... |
mod bst;
use bst::*;
use std::fs::File;
use std::io::BufRead;
use std::io::BufReader;
fn main() {
let mut bst = BST::new();
let file = File::open("./src/res/morse.txt").expect("file not found");
let input = File::open("./src/res/message.txt").expect("file not found");
for file_line in BufReader::new(... |
use crate::debug;
use crate::token::*;
use crate::source::Source;
use std::rc::Rc;
use anyhow::{anyhow, Result};
macro_rules! trace {
($self:ident, $msg: literal, $expression: expr) => {
debug!("start : {} : {:?}", $msg, $self.iter.peek());
let res = $expression;
debug!("end : {} : {:?... |
pub mod rand;
use math::big::Int;
pub fn is_big_int_normalized(x: &Int) -> bool {
match x.bits().next_back() {
None => x.sign() == 0,
Some(v) => v != 0,
}
}
|
pub use hex;
pub use downcast_rs;
pub use slice_cast;
|
#[doc = r"Value read from the register"]
pub struct R {
bits: u8,
}
#[doc = r"Value to write to the register"]
pub struct W {
bits: u8,
}
impl super::TXCSRH4 {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'... |
#[doc = "Reader of register CR"]
pub type R = crate::R<u32, super::CR>;
#[doc = "Writer for register CR"]
pub type W = crate::W<u32, super::CR>;
#[doc = "Register CR `reset()`'s with value 0"]
impl crate::ResetValue for super::CR {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
... |
use anyhow::{anyhow, Context, Result};
use image::RgbaImage;
use std::fs::File;
use std::io::Read;
use std::path::PathBuf;
use std::sync::atomic::{AtomicBool, Ordering};
use tobj::{Material, Model};
use crate::logger::logger;
use slog::debug;
static mut LOADER: Option<&dyn ResourceLoader> = None;
static INITIALIZED: ... |
#[path = "with_flush_option/with_monitor.rs"]
mod with_monitor;
test_stdout!(without_monitor_returns_true, "true\n");
|
pub mod buildaccelerationstructureflagsnv;
pub mod copyaccelerationstructuremodenv;
pub mod geometryflagsnv;
pub mod geometryinstanceflagsnv;
pub mod geometrytypenv;
pub mod raytracingshadergrouptypenv;
pub mod accelerationstructurememoryrequirementstypenv;
pub mod accelerationstructuretypenv;
pub mod prelude;
|
//! Tests auto-converted from "sass-spec/spec/libsass/features"
#[allow(unused)]
use super::rsass;
#[allow(unused)]
use rsass::precision;
// Ignoring "at-error", not expected to work yet.
// Ignoring "extend-selector-pseudoclass", not expected to work yet.
/// From "sass-spec/spec/libsass/features/global-variable-sh... |
fn main() {
proconio::input!{n:u64};
println!("{}", n / 500 * 1000 + ((n % 500) / 5) * 5)
} |
use game_lib::{
bevy::prelude::*,
derive_more::{Display, From, Into},
serde::{Deserialize, Serialize},
};
#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash, Serialize, Deserialize, Reflect)]
#[serde(crate = "game_lib::serde")]
pub enum Tile {
Stone,
Dirt,
}
impl Tile {
pub fn index(self) -> Til... |
use crate::utils;
pub fn run(problem: &i32, input: &str) {
match problem {
1 => {
problem1(input);
}
2 => {
problem2(input);
}
_ => {
panic!("Unknown problem: {}", problem);
}
};
}
fn problem1(input: &str) {
let mut total ... |
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(clippy::missing_safety_doc)]
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
mod ioctl;
pub use ioctl::*;
|
use anyhow::*;
use liblumen_alloc::erts::exception;
use liblumen_alloc::erts::term::prelude::*;
#[native_implemented::function(erlang:system_flag/2)]
pub fn result(flag: Term, _value: Term) -> exception::Result<Term> {
let flag_atom = term_try_into_atom!(flag)?;
match flag_atom.name() {
"backtrace_de... |
use crate::io::Encode;
use crate::mssql::io::MssqlBufMutExt;
use crate::mssql::protocol::header::{AllHeaders, Header};
#[derive(Debug)]
pub(crate) struct SqlBatch<'a> {
pub(crate) transaction_descriptor: u64,
pub(crate) sql: &'a str,
}
impl Encode<'_> for SqlBatch<'_> {
fn encode_with(&self, buf: &mut Vec... |
use std::cmp::min;
use std::collections::hash_map::HashMap;
use crate::parser::ast_utils::*;
use crate::parser::tokens::*;
use crate::parser::ast_printer::print_ast_node;
use super::stored_value::StoredValue;
use super::constexpr::get_constant_value_from_node;
// AMD64 assembly codegen
// In the x86-64 System V calli... |
use crate::qrcode::QrCodeScanner;
use flutter_plugins::prelude::*;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
const PLUGIN_NAME: &str = module_path!();
const CHANNEL_NAME: &str = "rust/qrcode";
#[derive(Default)]
pub struct QrCodePlugin {
handler: Arc<RwLock<Handler>>,
}
#[derive(Default)... |
#[cfg(target_os = "macos")]
fn main() {
println!("cargo:rustc-link-lib=framework=IOKit");
println!("cargo:rustc-link-lib=framework=CoreFoundation");
}
#[cfg(not(target_os = "macos"))]
fn main() {}
|
use std::fs;
fn main() {
let data = fs::read("/etc/hosts")
.expect("Unable to read file");
println!("{}", data.len());
}
|
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//! Module holding different kinds of pseudo files and their building blocks.
use {
crate::directory::entry::DirectoryEntry,
libc::{S_IRUSR, S_IWU... |
#[macro_use]
extern crate lazy_static;
extern crate log as log_crate;
extern crate poe_alloc;
pub mod allocator {
pub use poe_alloc::PoeAlloc;
pub const POE_ALLOC: PoeAlloc = PoeAlloc {};
}
pub mod env;
pub mod io;
pub mod log;
mod resource;
pub use resource::Resource;
|
extern crate cortex_m;
use super::PERIPH;
use boards::nrf51dk::BUTTONS;
pub struct Button {
pub i: usize,
}
impl Button {
pub fn init() {
cortex_m::interrupt::free(|cs| {
if let Some(p) = PERIPH.borrow(cs).borrow().as_ref() {
//configure pins in pull up... |
use std::borrow::Cow;
use std::hash::Hash;
use std::ops::Range;
/// Reference to a [`DiffableStr`].
///
/// This type exists because while the library only really provides ways to
/// work with `&str` and `&[u8]` there are types that deref into those string
/// slices such as `String` and `Vec<u8>`.
///
/// This trait... |
use crate::schema::projetos_ensino;
use chrono::NaiveDateTime;
#[derive(Serialize, Deserialize, Queryable)]
pub struct ProjetosEnsino {
pub id: i32,
pub id_professor: i32,
pub titulo: String,
pub numero_edital: i32,
pub ano_edital: i32,
pub created_at: NaiveDateTime,
pub updated_at: NaiveDa... |
pub mod benchmarks;
#[cfg(not(feature = "ouroboros_compare"))]
pub mod self_cell_cells;
#[cfg(feature = "ouroboros_compare")]
pub mod ouroboros_cells;
|
use objects::*;
use types::init_types;
use std::hashmap::HashMap;
type GlobalEnv = HashMap<~str, SchemeObject>;
#[deriving(Eq, Clone)]
pub struct SchemeEnv {
// TODO: Hashmap?
// TODO: max size?
symbols: ~[SchemeObject],
values: ~[SchemeObject],
globals: GlobalEnv,
next: Option<~SchemeEnv>
}... |
#[cfg(test)]
mod test;
use liblumen_alloc::erts::process::Process;
use liblumen_alloc::erts::term::prelude::*;
use crate::runtime::scheduler::SchedulerDependentAlloc;
#[native_implemented::function(erlang:make_ref/0)]
pub fn result(process: &Process) -> Term {
process.next_reference()
}
|
use crate::errors::ApiError;
use actix_web::web::Json;
use serde::Serialize;
/// Helper function to reduce boilerplate of an OK/Json response
pub fn respond_json<T>(data: T) -> Result<Json<T>, ApiError>
where
T: Serialize,
{
Ok(Json(data))
}
#[cfg(test)]
mod tests {
use super::*;
#[derive(Clone, Debu... |
use eosio::*;
use eosio_cdt::*;
use std::marker::PhantomData;
#[eosio::action]
pub fn exec(
executer: PhantomData<AccountName>,
trx: PhantomData<Transaction<Vec<u8>>>,
) {
require_auth(current_receiver());
let mut ds = current_data_stream();
let executer = ds.read::<AccountName>().expect("read");
... |
//! The `generators` module contains API for producing a
//! set of generators for a rangeproof.
#![allow(non_snake_case)]
#![deny(missing_docs)]
// XXX we should use Sha3 everywhere
use sha2::{Digest, Sha512};
use curve25519_dalek::ristretto::RistrettoPoint;
use curve25519_dalek::scalar::Scalar;
use curve25519_dale... |
//! Plumbing used to expose external functions written in rust to LLVM.
//!
//! The core data-structure here is [`IntrinsicMap`], which lazily decalres external functions
//! based on a type signature.
use super::attr;
use crate::codegen::FunctionAttr;
use crate::common::Either;
use crate::compile::Ty;
use hashbrown::... |
use std::fs::File;
use std::io::BufRead;
use std::io::BufReader;
#[macro_use] extern crate text_io;
struct Rect{
id: usize,
x: usize,
y: usize,
w: usize,
h: usize
}
fn solve(v: &[Rect]) {
let mut m = [[0;1000];1000];
for r in v {
for row in &mut m[r.y..r.y+r.h] {
for it... |
fn largest_i32(list: &[i32]) -> i32{
let mut largest = list[0];
for &item in list.iter(){
if item > largest {
largest = item;
}
}
largest
}
fn largest_char(list: &[char]) -> char {
let mut largest = list[0];
for &item in list.iter(){
if item > largest {
... |
pub use self::ballsystem::BallSystem;
pub use self::paddlesystem::PaddleSystem;
pub use self::ballbouncesystem::BallBounceSystem;
mod ballsystem;
mod paddlesystem;
mod ballbouncesystem;
|
use core::alloc::Layout;
use core::ptr::NonNull;
use log::trace;
use liblumen_core::util::pointer::distance_absolute;
use crate::erts::exception::AllocResult;
use crate::erts::term::prelude::{Boxed, ProcBin, Term};
use super::alloc::{self, *};
use super::gc::{self, *};
use super::{Process, ProcessFlags};
/// This ... |
pub struct Solution;
use std::collections::HashMap;
impl Solution {
pub fn largest_divisible_subset(nums: Vec<i32>) -> Vec<i32> {
Solver::default().solve(nums)
}
}
#[derive(Default)]
struct Solver {
ranks: Vec<Vec<i32>>,
prev: HashMap<i32, i32>,
}
impl Solver {
fn solve(mut self, mut num... |
#[doc = "Reader of register ATCR1"]
pub type R = crate::R<u32, super::ATCR1>;
#[doc = "Writer for register ATCR1"]
pub type W = crate::W<u32, super::ATCR1>;
#[doc = "Register ATCR1 `reset()`'s with value 0x0007_0000"]
impl crate::ResetValue for super::ATCR1 {
type Type = u32;
#[inline(always)]
fn reset_valu... |
use itertools::Itertools;
use whiteread::parse_line;
fn main() {
let mut mods200: Vec<Vec<u64>> = vec![vec![]; 200];
let n: u64 = whiteread::parse_line().unwrap();
let aa: Vec<u64> = whiteread::parse_line().unwrap();
for a in aa {
mods200[(a % 200) as usize].push(a);
}
let mut count ... |
use crate::{drawing::JsDrawing, graph::JsGraph};
use petgraph_algorithm_shortest_path::warshall_floyd;
use petgraph_quality_metrics::{crossing_number, neighborhood_preservation, stress};
use wasm_bindgen::prelude::*;
#[wasm_bindgen(js_name = stress)]
pub fn js_stress(graph: &JsGraph, drawing: &JsDrawing) -> f32 {
... |
use crate::material::Material;
use crate::math::*;
use crate::{HitRecord, Ray};
use nalgebra::Unit;
use rand::RngCore;
use rand_distr::{Distribution, Uniform};
use std::sync::Arc;
use std::f64::consts::{PI, TAU};
pub trait Hittable: Sync + Send {
fn hit(&self, ray: &Ray, t_min: f64, t_max: f64) -> Option<HitRecor... |
use crate::cli;
use crate::intcode;
use crate::intcode::{Int, Program};
const MAGIC_TARGET_VALUE: Int = 19690720;
pub fn run() {
let filename = cli::aoc_filename("aoc_2019_02.txt");
let prog = intcode::read_from_file(filename);
println!("Part One: {}", eval_noun_verb(&prog, 12, 2));
let mut result: I... |
use itertools::Itertools;
use whiteread::parse_line;
use std::collections::HashSet;
fn main() {
let n: u64 = parse_line().unwrap();
let s: String = parse_line().unwrap();
let mut one = HashSet::new();
let mut two: HashSet<(usize, usize)> = HashSet::new();
let mut three: HashSet<(usize, usize, usi... |
use crate::prelude::*;
use std::os::raw::c_void;
use std::ptr;
#[repr(C)]
#[derive(Debug)]
pub struct VkImageViewCreateInfo {
pub sType: VkStructureType,
pub pNext: *const c_void,
pub flags: VkImageViewCreateFlagBits,
pub image: VkImage,
pub viewType: VkImageViewType,
pub format: VkFormat,
... |
use datamodel_parser::RootTypes;
use datamodel_parser::DataModelTypeRef;
use datamodel_parser::DataModelFieldDeclaration;
use std::string::String;
use std::fmt::{Write, Error};
use std::collections::HashMap;
pub struct DOTFormatterOptions {}
struct Port {
left: Option<String>,
right: Option<String>,
}
pub fn... |
// Copyright 2019 Stichting Organism
//
// 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... |
use core::intrinsics;
use core::iter::Iterator;
use core::ops::Range;
/// Provides volatile read/write access to a location in memory. This prevents
/// the compiler's optimizer from trying to mess with our register operations.
pub struct Register<T> {
value: T
}
impl<T> Register<T> {
/// Perform a volatile r... |
use std::thread;
fn main() {
let child = thread::spawn(move || {
println!("Hello thread");
});
let res = child.join();
} |
use std::collections;
use super::zobrist::BoardHasher;
use super::zobrist::PosHash;
use super::super::go::GoGame;
fn generate_hashes(depth: usize, hasher: &BoardHasher, game: &mut GoGame,
seen: &mut collections::HashMap<PosHash, GoGame>) {
if depth <= 0 {
return;
}
for v in game.possible_moves(game.to_play)... |
use crate::event::GameEvent;
use crate::resources::Resources;
use shrev::{EventChannel, ReaderId};
pub struct GameOver {
rdr_id: ReaderId<GameEvent>,
}
impl GameOver {
pub fn new(resources: &mut Resources) -> Self {
let mut chan = resources.fetch_mut::<EventChannel<GameEvent>>().unwrap();
let ... |
use bintree::Tree;
use std::fmt;
use P55::cbal_trees;
use P56::is_symmetric;
pub fn symmetric_balanced_trees<T: Copy + fmt::Display>(n: usize, v: T) -> Vec<Tree<T>> {
cbal_trees(n, v)
.into_iter()
.filter(|t| is_symmetric(&t))
.collect()
}
#[cfg(test)]
mod tests {
use super::*;
#[... |
use advent::helpers;
use anyhow::{Context, Result};
use derive_more::Display;
use helpers::grid::Grid;
use itertools::Itertools;
use num_integer::Roots;
use std::ops::RangeInclusive;
use std::{collections::VecDeque, str::FromStr};
#[derive(Debug, Clone, Copy, Display, PartialEq, Eq)]
enum Pixel {
#[display(fmt = "... |
use libc::{opendir, readdir, chdir, closedir};
use std::ffi::CStr;
fn main() {
let dir_path = b".\x00".as_ptr() as *const i8;
let dir = unsafe { opendir(dir_path) };
unsafe { chdir(dir_path); }
loop{
let dirent = unsafe { readdir(dir) };
if dirent.is_null(){
... |
#![allow(unused)]
use crate::style::StyledNode;
use crate::css;
use crate::css::{Value,Unit};
#[derive(Default, Clone, Copy)]
struct Dimensions {
content: Rect,
padding: EdgeSizes,
border: EdgeSizes,
margin: EdgeSizes,
}
impl Dimensions {
fn padding_box(self) -> Rect {
self.content.expand... |
/*use crate::data_set_parser::DataSetParser;
use crate::encoding::Encoding;
use crate::encoding::ImplicitLittleEndian;
use crate::handler::Handler;
use crate::meta_information;
use crate::meta_information::MetaInformation;
use crate::value_parser::ParseError;
use crate::value_parser::ParseResult;
#[derive(Debug, Defau... |
use crate::{
error::Error,
model::{CreateUser, User},
};
use async_trait::async_trait;
#[async_trait]
pub trait Service: Sync + Send {
async fn create_user(&self, user: CreateUser) -> Result<User, Error>;
async fn list_users(&self) -> Result<Vec<User>, Error>;
async fn get_user(&self, id: i32) -> R... |
#[derive(Debug, PartialEq)]
pub(crate) struct Flags {
pub(crate) zero: bool, // Zero - when arithmetic result is 0
pub(crate) sign: bool, // Sign - when the most significant bit is set
pub(crate) parity: bool, // Parity - when the answer has even parity
pub(crate) carry: bool, // Carry - when the i... |
//! Defines a structure to store the configuration of the exploration. The configuration
//! is read from the `Setting.toml` file if it exists. Some parameters can be overridden
//! from the command line.
extern crate toml;
use std::fs::File;
use std::io::{self, BufWriter, Write};
use std::path::{Path, PathBuf};
use ... |
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
failure::{format_err, Error, ResultExt},
fidl_fuchsia_cobalt::{LoggerFactoryMarker, LoggerProxy, ReleaseStage},
fuchsia_async as fasync,
... |
use std::cmp::Ordering;
use ggez::graphics as ggraphics;
use ggez::input::mouse::MouseButton;
use crate::device::*;
use crate::numeric;
pub type Texture = ggraphics::Image;
pub trait DrawableComponent {
/// このトレイトを実装する場合、このメソッドには描画を行う処理を記述する
fn draw(&mut self, ctx: &mut ggez::Context) -> ggez::GameResult<()... |
#[doc = "Reader of register MDIER"]
pub type R = crate::R<u32, super::MDIER>;
#[doc = "Writer for register MDIER"]
pub type W = crate::W<u32, super::MDIER>;
#[doc = "Register MDIER `reset()`'s with value 0"]
impl crate::ResetValue for super::MDIER {
type Type = u32;
#[inline(always)]
fn reset_value() -> Sel... |
// auto generated, do not modify.
// created: Mon Feb 22 23:57:02 2016
// src-file: /QtGui/qabstracttextdocumentlayout.h
// dst-file: /src/gui/qabstracttextdocumentlayout.rs
//
// header block begin =>
#![feature(libc)]
#![feature(core)]
#![feature(collections)]
extern crate libc;
use self::libc::*;
// <= header blo... |
use bitcoin::Transaction;
use CRgbNeededTx;
use CRgbSerializedTx;
use generics::WrapperOf;
use rgb::traits::NeededTx;
use std::collections::HashMap;
use std::mem;
#[no_mangle]
pub extern "C" fn rgb_init_needed_tx_map(map: &mut Box<HashMap<NeededTx, Transaction>>) {
let mut new_map = Box::new(HashMap::new());
m... |
#![deny(unreachable_patterns)]
#![deny(unknown_lints)]
#![deny(unused_variables)]
#![deny(unused_imports)]
// Unused results is more often than not an error
#![deny(unused_must_use)]
//#![deny(unused_extern_crates)]
extern crate actix_web;
extern crate bigneon_db;
extern crate diesel;
extern crate dotenv;
//extern crat... |
fn main() {
if let Some(x) = Some(1) {
}
} |
use std::{fmt, str::FromStr};
use hex::FromHex;
use rand::Rng;
use serde::{Deserialize, Serialize};
// Zenith ID is a 128-bit random ID.
// Used to represent various identifiers. Provides handy utility methods and impls.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, PartialOrd, Ord)]
struc... |
extern crate regex;
extern crate glob;
mod network;
use std::process::Command;
use glob::glob;
use network::Network;
use std::io::prelude::*;
use std::fs::File;
fn main() {
let config = glob("/etc/wpa_supplicant/wpa_supplicant-*.conf");
for file in config.unwrap() {
let mut f = File::open(file.unwrap... |
// auto generated, do not modify.
// created: Mon Feb 22 23:57:02 2016
// src-file: /QtWidgets/qspinbox.h
// dst-file: /src/widgets/qspinbox.rs
//
// header block begin =>
#![feature(libc)]
#![feature(core)]
#![feature(collections)]
extern crate libc;
use self::libc::*;
// <= header block end
// main block begin =>... |
use core::ops::Try;
use uefi::runtime_services::RuntimeServices;
use color::*;
use kernel_proto::{Info, MemoryDescriptor};
use display::Display;
use console::{Console, set_console};
extern {
static _magic: usize;
static _info: *const Info;
}
#[no_mangle]
pub extern fn start_uefi() {
let magic = unsafe { _... |
// This file is part of ICU4X. For terms of use, please see the file
// called LICENSE at the top level of the ICU4X source tree
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
use core::convert::TryFrom;
use core::ops::{Add, Sub};
use core::str::FromStr;
use displaydoc::Display;
use icu_locid... |
use std::fs;
fn part_1(time_arrival: &u32, bus_ids: &Vec<u32>) -> u32 {
let times: Vec<(&u32, u32)> = bus_ids
.into_iter()
.map(|bus_id| (bus_id, bus_id - (time_arrival % bus_id)))
.collect();
let mut min: (&u32, u32) = (&0, u32::max_value());
for time in times {
if time.1 ... |
use crate::prelude::*;
use nannou::geom::Tri;
pub trait TrianglesExtension {
fn subdivide(
self,
rand: &mut Rand,
num_subdivisions: usize,
min_skew: NormalizedF32,
max_skew: NormalizedF32,
) -> Vec<Tri<Point2>>;
}
impl TrianglesExtension for Vec<Tri<Point2>> {
fn su... |
use regex::Regex;
use crate::emulator::{Vm, VmState};
use std::{
collections::{hash_map::DefaultHasher, BTreeMap, HashSet},
hash::{Hash, Hasher},
};
pub struct GameSolver {}
impl GameSolver {
pub fn explore_maze(vm: &Vm) {
let message = vm.get_messages().last().unwrap();
let level = Level... |
// Copyright 2020, The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// disclai... |
use proconio::input;
fn main() {
input! {
n: usize,
a: [u32; n],
};
let min = a.iter().min().copied().unwrap();
let max = a.iter().max().copied().unwrap();
assert_eq!(max - min, n as u32);
for x in min..=max {
if a.contains(&x) == false {
println!("{}", x);
... |
use super::{
partitioner::PartitionError, retention_validation::RetentionError, RpcWriteError, SchemaError,
};
use async_trait::async_trait;
use data_types::{NamespaceName, NamespaceSchema};
use std::{error::Error, fmt::Debug, sync::Arc};
use thiserror::Error;
use trace::ctx::SpanContext;
/// Errors emitted by a [... |
mod program;
mod vertex_array;
mod buffer;
mod primitive_type;
mod filter;
mod wrap;
mod texture;
mod attachment;
mod framebuffer;
pub use program::{ProgramId, Program};
pub use vertex_array::{VertexArrayId, VertexArray};
pub use buffer::{BufferTarget, BufferUsage, BufferId, Buffer, VertexBuffer, ElementBuffer};
pub u... |
/*!
# Why is this here?
Because *both* Cargo and Rust both know better than I do and won't let me tell them to stop running the tests in parallel. This is a problem because they do not, in fact, know better than me: Cargo doesn't do *any* locking, which causes random failures as two tests try to update the registry s... |
use std::io;
use std::io::Write;
struct Baby {
name: String,
past_weight: i32,
present_weight: i32,
}
impl Baby {
fn new(name: String, past_weight: i32, present_weight: i32) -> Self {
Self { name, past_weight, present_weight }
}
}
fn main() {
// let mut data: Vec<Baby>... |
// Copyright 2020-2021, The Tremor Team
//
// 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 agr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.