text stringlengths 8 4.13M |
|---|
//! Module containing top-level server error handling. Errors here are
//! formatted and sent back to a client.
use crate::connections::account_handlers::{
DuplicateAccountRejection, EmailVerificationRejection, InvalidLoginRejection,
PasswordInsecureRejection, ValidationRejection,
};
use crate::connections::ga... |
use genapkbuild::build::{BuildSystemBase, BuildSystemBaseBuilder};
use std::fs::File;
use std::io::prelude::*;
use std::path::Path;
// Helper methods for tests
// run with `cargo test -- --nocapture` for the logs
// run with `cargo test -- --test-threads=1` for single threaded tests
pub fn mk_contains(data: &str) -> ... |
//! Documentation for the module
//!
//! **Lorem ipsum** dolor sit amet, consectetur adipiscing elit. Aenean a
//! sagittis sapien, eu pellentesque ex. Nulla facilisi. Praesent eget sapien
//! sollicitudin, laoreet ipsum at, fringilla augue. In hac habitasse platea
//! dictumst. Nunc in neque sed magna suscipit mattis ... |
#[doc = "Reader of register INTR_MASK"]
pub type R = crate::R<u32, super::INTR_MASK>;
#[doc = "Writer for register INTR_MASK"]
pub type W = crate::W<u32, super::INTR_MASK>;
#[doc = "Register INTR_MASK `reset()`'s with value 0"]
impl crate::ResetValue for super::INTR_MASK {
type Type = u32;
#[inline(always)]
... |
#![feature(box_syntax)]
use std::thread;
use std::time::Duration;
use webserver::{
Server,
Handler,
Request,
Response
};
fn handlers() -> Vec<(String, String, Handler)> {
vec![
("GET".to_string(), "/".to_string(), box |_| {
Response::from_params(200, include_str!("pages/hello.ht... |
//! Provide helpers for making ioctl system calls
//!
//! Currently supports Linux on all architectures. Other platforms welcome!
//!
//! This library is pretty low-level and messy. `ioctl` is not fun.
//!
//! What is an `ioctl`?
//! ===================
//!
//! The `ioctl` syscall is the grab-bag syscall on POSIX syste... |
use std::borrow::Cow;
use std::cell::{RefCell, Ref};
use std::fmt;
use std::any::{Any, TypeId};
use std::collections::HashMap;
use std::result::Result as StdResult;
use std::string::String as StdString;
use base::ast::{Typed, ASTType};
use base::metadata::{Metadata, MetadataEnv};
use base::symbol::{Name, Symbol};
use ... |
// Copyright (c) 2017 The Noise-rs Developers.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT
// or http://opensource.org/licenses/MIT>, at your option. All files in the
// project carrying such notice may not be cop... |
use crate::errors::JslError;
use crate::schema::{Form, Schema, Type};
use crate::validator::ValidationError;
use chrono::DateTime;
use failure::{err_msg, Error};
use json_pointer::JsonPointer;
use serde_json::Value;
use std::borrow::Cow;
pub fn validate<'a>(
max_failures: usize,
max_depth: usize,
strict_in... |
#[doc = "Register `ISR` reader"]
pub type R = crate::R<ISR_SPEC>;
#[doc = "Field `SYNCOKF` reader - SYNC event OK flag"]
pub type SYNCOKF_R = crate::BitReader;
#[doc = "Field `SYNCWARNF` reader - SYNC warning flag"]
pub type SYNCWARNF_R = crate::BitReader;
#[doc = "Field `ERRF` reader - Error flag"]
pub type ERRF_R = c... |
//! This module implements cluster partitioning for a collection of trees. It decomposes a
//! collection of trees into a collection of clusters and allows the tree-child sequences
//! of the clusters to be combined into a tree-child sequence for the whole input.
//!
//! This implementation does not work with the leaf... |
use std::collections::HashMap;
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use futures::{future, lock::Mutex};
use actix_web::{App, HttpServer, Result, HttpResponse, error, http,
web::{post, Data, Payload}};
use actix_web_static_files::ResourceFiles;
use webrtc_unreliable::{Server, SessionEndpoint};
include!(co... |
use crate::ast::*;
use hashbrown::HashMap;
use crate::token::Token;
use crate::lexer::Lexer;
type ParseError = String;
type ParseErrors = Vec<ParseError>;
pub type ParseResult<T> = Result<T, ParseError>;
type PrefixFn = fn(parser: &mut Parser<'_>) -> ParseResult<Expression>;
type InfixFn = fn(parser: &mut Parser<'_>, ... |
use std::fs;
use std::collections::VecDeque;
use std::collections::BTreeMap;
use std::collections::HashMap;
use std::char;
#[derive(Clone)]
struct Computer{
ip: usize,
program: BTreeMap<usize, i64>,
relbase: i64,
}
impl Computer {
fn new(program: BTreeMap<usize, i64>) -> Computer {
Computer { ... |
use std::collections::HashMap;
use std::convert::TryFrom;
use std::fmt;
use std::str::FromStr;
mod common;
enum Direction {
U,
D,
L,
R,
}
struct DirectedVec {
direction: Direction,
length: i64,
}
struct DirectedPath {
segment: Vec<DirectedVec>,
}
impl FromStr for Direction {
type Err... |
mod boilerplate;
#[rustc_on_unimplemented = "`{Self}` is not a composite type"]
pub trait IsComposite: Sized {
type H;
type T;
#[inline] fn split(self) -> (Self::H, Self::T);
#[inline] fn head (self) -> Self::H { self.split().0 }
#[inline] fn tail (self) -> Self::T { self.split().1 }
}
#[rustc_on... |
/**
* By BingLi224
* 22:28 THA 25/08/2019
*
* Test Mutex+Arc
*
* Each threads are the players that can change the racing position with
* predefined role to be either -1 or 1. The player sleeps after each action.
* The game stops when the game position reaches the positive-or-negative
* target, and all other p... |
use crate::intcode::IntCode;
#[derive(Copy, Clone, Debug, PartialOrd, Ord, PartialEq, Eq, Hash)]
struct Position(usize, usize);
#[derive(Clone)]
struct Drone {
program: IntCode,
}
impl Drone {
fn new(program: IntCode) -> Self {
Self { program }
}
fn probe(&mut self, position: Position) -> i6... |
pub mod decode;
use std::io;
use super::objects::{ObjectRef, ObjectStore, PrimitiveObjects};
pub fn read_object<R: io::Read>(reader: &mut R, store: &mut ObjectStore, primitive_objects: &PrimitiveObjects) -> Result<ObjectRef, decode::UnmarshalError> {
decode::read_object(reader, store, primitive_objects, &mut Vec... |
#[allow(unused_imports)]
#[macro_use]
extern crate limn;
#[macro_use]
extern crate lazy_static;
extern crate env_logger;
extern crate gleam;
extern crate euclid;
mod util;
use std::cell::Cell;
use std::rc::Rc;
use std::iter::once;
use gleam::gl::{self, GLushort, GLint, GLuint, GLfloat};
use euclid::{Vector3D, Trans... |
#[doc = "Reader of register USB_MUXING"]
pub type R = crate::R<u32, super::USB_MUXING>;
#[doc = "Writer for register USB_MUXING"]
pub type W = crate::W<u32, super::USB_MUXING>;
#[doc = "Register USB_MUXING `reset()`'s with value 0"]
impl crate::ResetValue for super::USB_MUXING {
type Type = u32;
#[inline(always... |
use std::collections::HashMap;
use std::num::ParseIntError;
use std::str::FromStr;
fn main() {
let input = include_str!("input.txt");
let hot_spots = parse_input(input);
println!("Answer #1: {}", answer_1(hot_spots.clone()));
println!("Answer #2: {}", answer_2(&hot_spots, 10000));
}
fn answer_1(mut ho... |
#[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::PADREGE {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w m... |
use semver::Version;
use stremio_core::types::addons::*;
use stremio_addon_sdk::scaffold::Scaffold;
pub fn get_manifest() -> Manifest {
Manifest {
id: "org.test".into(),
name: "Rust Example Addon".into(),
version: Version::new(1, 0, 0),
resources: vec![
ManifestResource:... |
use azure_core::headers::CommonStorageResponseHeaders;
use bytes::Bytes;
use http::Response;
use std::convert::{TryFrom, TryInto};
#[derive(Debug, Clone)]
pub struct DeleteTableResponse {
pub common_storage_response_headers: CommonStorageResponseHeaders,
}
impl TryFrom<&Response<Bytes>> for DeleteTableResponse {
... |
/// Ensuring one lifetime outlives another with lifetime subtyping
//struct Context<'a>(&'a str);
//
//struct Parser<'a> {
// context: &'a Context<'a> // weird how the lifetime has to be specified everywhere
//}
//
//impl<'a> Parser<'a> {
// fn parse(&self) -> Result<(), &str> {
// Err(&self.context.0[1..... |
#![allow(unused)]
use rand::Rng;
use std::convert::TryInto;
use std::io;
use std::fs::File;
use std::cmp::Ordering;
use std::vec::Vec;
use std::io::{Write, BufReader, BufRead, ErrorKind};
fn test_bool() -> () {
let a : bool = true;
let b : bool = false;
print!("Bool Value: {} \n", a);
print!("Bool Va... |
use crate::cpu::instruction::{DecodeError, Result};
use crate::cpu::Register;
use crate::util::*;
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
pub enum ShifterOperand {
Immediate {
value: u8,
rotate: u8,
},
Shift {
operation: ShiftOperation,
source: Register,
operand... |
extern crate serialport;
#[macro_use]
extern crate serde_derive;
extern crate enigo;
extern crate serde;
extern crate serde_json as json;
extern crate subprocess;
use prelude::*;
use subprocess::{Exec};
use std::thread;
use std::time::{Duration};
use config::{Config};
use connection::{Connection};
mod config;
mod co... |
pub mod randorst;
pub mod termprep;
use bytecount;
use std::fs::File;
use std::io::{self, BufRead};
use std::path::Path;
use tui::widgets::ListState;
#[derive(Default)]
pub struct StatefulList<T> {
pub state: ListState,
pub items: Vec<T>,
}
impl<T> StatefulList<T> {
pub fn new() -> StatefulList<T> {
... |
pub fn main() {
let mut sum_of_square: u32 = 0;
let mut square_of_sum: u32 = 0;
let difference: u32;
for i in 1..101 {
sum_of_square += (i as u32).pow(2);
square_of_sum += i;
}
square_of_sum = square_of_sum.pow(2);
difference = square_of_sum - sum_of_square;
println!("... |
mod common;
#[cfg(not(feature = "host"))]
mod device;
#[cfg(feature = "host")]
mod host;
#[cfg(not(feature = "host"))]
#[allow(clippy::module_name_repetitions)]
pub use device::CudaExchangeBufferDevice as CudaExchangeBuffer;
#[cfg(feature = "host")]
#[allow(clippy::module_name_repetitions)]
pub use host::CudaExchangeB... |
#![feature(proc_macro_hygiene, decl_macro)]
pub mod schema;
#[macro_use]
extern crate rocket;
#[macro_use]
extern crate rocket_contrib;
#[macro_use]
extern crate diesel;
use chrono::{DateTime, Utc};
use diesel::result::Error;
use diesel::RunQueryDsl;
use rocket::http::Status;
use rocket_contrib::json::Json;
use sc... |
use tokio::process::Command;
use anyhow::{Result, Context, Error};
use async_trait::async_trait;
use crate::{
services::model::{Nameable, Ensurable},
helpers::ExitStatusIntoUnit
};
static NAME: &str = "KFP Service";
static SERVICE_NAME: &str = "ml-pipeline";
#[derive(Default)]
pub struct KfpServ... |
fn main(){
println!("Hello World"); //! means calling a macro instead of a normal function
}
// Cargo is Rust's build sysem and package manager --> Similar to npm or pip. |
//shrsi t,n,k-1 Form the integer
//shri t,t,32-k 2**k – 1 if n < 0, else 0.
//add t,n,t Add it to n,
//shrsi q,t,k and shift right (signed).
//bge n,label Branch if n >= 0.
//addi n,n,2**k-1 Add 2**k - 1 to n,
//shrsi n,n,k and shift right (signed).
//shrsi q,n,k
//addze q,q
use chapter2::basics_abs;
... |
use std::{
collections::BTreeSet,
fs::File,
io::{BufRead, BufReader, Write},
};
use std::io::{Read, stdin};
pub fn ammend(raw_manager_dir: &str, dependent_package: &str) {
let package_file_dir = crate::format_and_trim(raw_manager_dir, dependent_package);
let file = File::open(&package_file_dir).exp... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - SWPMI Configuration/Control register"]
pub cr: CR,
#[doc = "0x04 - SWPMI Bitrate register"]
pub brr: BRR,
_reserved2: [u8; 0x04],
#[doc = "0x0c - SWPMI Interrupt and Status register"]
pub isr: ISR,
#[doc = "... |
#![allow(clippy::module_inception)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::ptr_arg)]
#![allow(clippy::large_enum_variant)]
#![doc = "generated by AutoRust 0.1.0"]
#[cfg(feature = "package-2021-05")]
pub mod package_2021_05;
#[cfg(all(feature = "package-2021-05", not(feature = "no-default-version")))]
pu... |
use std::collections::HashMap;
fn main() {
let mut scores = HashMap::new();
scores.insert(String::from("Blue"), 10);
scores.insert(String::from("Blue"), 25);
// Only prints { "Blue": 25 }
// Original value of 10 has been overwritten
println!("scores: {:?}", scores);
// **Only inserting ... |
//! Implementation of the game rules
use std::collections::HashSet;
use std::iter::FromIterator;
#[derive(Clone, Debug, PartialEq, Eq)]
struct Nim {
tokens: Vec<TokenState>,
current_player: u8,
player_count: u8,
last_token_taken_by: Option<u8>,
}
#[derive(Clone)]
struct NimAction {
token_indices:... |
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
use crate::action::Action;
use crate::player::Player;
use crate::rotation::Rotation;
use crate::target::Target;
use crate::time::*;
use slog::info;
use std::rc::Rc;
/// Performs an entire simulated rotation on a target. This is the main struct
/// for clockwork-mage; everything on top of this is just I/O-type things, ... |
use crate::event::*;
use super::{ Actor, ActorMessageHandler };
use std::sync::Arc;
use std::{hash::Hash, collections::HashMap};
use async_trait::async_trait;
use futures::channel::oneshot;
use std::cell::RefCell;
enum ActorEvent<K: Eq + Hash + Clone, ACTOR: ActorMessageHandler> {
AddActor(K, Arc<Actor<ACTOR>>, A... |
#[derive(Clone, Copy, Default)]
pub struct Flags {
pub z: bool,
pub s: bool,
pub p: bool,
pub cy: bool,
pub ac: bool,
}
|
use crate::layout;
use super::auto::{AsAny, HasInner, Abstract};
use super::member::{AMember, Member, MemberBase, MemberInner};
has_settable!(Orientation(layout::Orientation): Member);
impl<II: HasOrientationInner, T: HasInner<I = II> + Abstract + 'static> HasOrientationInner for T {
fn orientation(&self, member... |
// Copyright (c) Facebook, Inc. and its affiliates.
use serde::{Deserialize, Serialize};
pub mod args;
pub mod bench;
pub mod cmd;
pub mod cmd_ack;
pub mod index;
pub mod oomd;
pub mod report;
pub mod side_defs;
pub mod slices;
pub mod sysreqs;
pub use args::{Args, DFL_TOP};
pub use bench::{BenchKnobs, HashdKnobs, Io... |
#[doc = "Register `PIR` reader"]
pub type R = crate::R<PIR_SPEC>;
#[doc = "Register `PIR` writer"]
pub type W = crate::W<PIR_SPEC>;
#[doc = "Field `IMODE` reader - Instruction mode"]
pub type IMODE_R = crate::FieldReader;
#[doc = "Field `IMODE` writer - Instruction mode"]
pub type IMODE_W<'a, REG, const O: u8> = crate:... |
#[doc = "Register `EPOCHSELCR` reader"]
pub type R = crate::R<EPOCHSELCR_SPEC>;
#[doc = "Register `EPOCHSELCR` writer"]
pub type W = crate::W<EPOCHSELCR_SPEC>;
#[doc = "Field `EPOCH_SEL` reader - select EPOCH value to be sent to the SAES 1x: EPOCH forced to zero (value used to retrieve PUF reference value at boot time)... |
#[doc = "Register `SFR` reader"]
pub type R = crate::R<SFR_SPEC>;
#[doc = "Register `SFR` writer"]
pub type W = crate::W<SFR_SPEC>;
#[doc = "Field `SFSA` reader - Secure Flash start address"]
pub type SFSA_R = crate::FieldReader;
#[doc = "Field `SFSA` writer - Secure Flash start address"]
pub type SFSA_W<'a, REG, const... |
use std::thread;
use std::time::Duration;
fn main() {
// let get_return = simulated_expensive_calculation(12);
// println!("get return: {}",get_return);
let simulated_user_pecified_value = 10;
let simulated_random_number = 7;
generate_workout(
simulated_user_pecified_value,
simulat... |
#![feature(unsize)]
pub mod traitvec;
#[test]
fn test() {
use crate::traitvec::TraitVec;
use std::pin::Pin;
let mut v: Pin<TraitVec<dyn std::fmt::Debug>> = TraitVec::new();
{
let x = v.as_ref().push(1);
let mut vec = v.as_ref().push(vec![1, 2, 3]);
vec.push(4);
asser... |
#[macro_use]
extern crate http_stub;
extern crate bitex;
extern crate fishermon;
extern crate env_logger;
use std::sync::{Arc, Mutex};
use http_stub as hs;
use http_stub::hyper::uri::RequestUri as Uri;
use http_stub::regex::Regex;
use bitex::Api;
use fishermon::{Trader, Strategy};
#[test]
fn trade(){
let cancelle... |
use crate::{
buffer::{
fragment_buffer::{FragmentSpan, FragmentTree},
Fragment, StringBuffer,
},
fragment::CellText,
util::parser,
Merge, Settings,
};
pub use cell::{Cell, CellGrid};
pub use contacts::Contacts;
pub use endorse::Endorse;
use itertools::Itertools;
use sauron::{
htm... |
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(dead_code)]
#![allow(unused_variables)]
use crate as pallet_deip_org;
use super::{*, Event as RawEvent, Call as RawCall};
use sp_std::prelude::*;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<TestRuntime>;
type Block = frame_system::mockin... |
/// Rabin-Karp algorithm for pattern searching
pub fn rabin_karp(txt: String, pat: String, prime_number: i64) -> Vec<usize> {
let mut res = Vec::<usize>::new();
// Rust strings are utf8 compatible and hence they can store all the 1,112,064 characters and not just the 256 ASCII characters
// Note: even if i... |
#[doc = "Register `PRIVBB1R` reader"]
pub type R = crate::R<PRIVBB1R_SPEC>;
#[doc = "Register `PRIVBB1R` writer"]
pub type W = crate::W<PRIVBB1R_SPEC>;
#[doc = "Field `PRIVBB1` reader - Privileged / unprivileged 8 Kbytes Flash Bank1 sector attribute (y = 0 to 7)"]
pub type PRIVBB1_R = crate::FieldReader;
#[doc = "Field... |
#[macro_use] extern crate lazy_static;
extern crate regex;
use std::fs::File;
use std::io::prelude::*;
use regex::Regex;
lazy_static! {
static ref ACT: Regex = Regex::new(r"^(N|S|E|W|L|R|F)(\d+)$").unwrap();
}
fn read_data(filepath: &str) -> std::io::Result<String> {
let mut file = File::open(filepath)?;
... |
mod address_list;
mod ip_address;
use address_list::AddressList;
fn main() {
let list = AddressList::new(String::from("input.txt"));
println!("TLS count: {}", list.tls_count());
}
|
#[doc = "Register `APB2ENR` reader"]
pub type R = crate::R<APB2ENR_SPEC>;
#[doc = "Register `APB2ENR` writer"]
pub type W = crate::W<APB2ENR_SPEC>;
#[doc = "Field `TIM1EN` reader - TIM1 clock enable Set and reset by software."]
pub type TIM1EN_R = crate::BitReader;
#[doc = "Field `TIM1EN` writer - TIM1 clock enable Set... |
#[doc = "Reader of register CAL_CTL"]
pub type R = crate::R<u32, super::CAL_CTL>;
#[doc = "Writer for register CAL_CTL"]
pub type W = crate::W<u32, super::CAL_CTL>;
#[doc = "Register CAL_CTL `reset()`'s with value 0"]
impl crate::ResetValue for super::CAL_CTL {
type Type = u32;
#[inline(always)]
fn reset_va... |
pub mod basic_io;
pub trait IO {
fn read_port(&self, port: u8) -> u8;
fn write_port(&mut self, port: u8, value: u8);
}
|
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Relaxed};
pub trait Signaller {
fn signal(&mut self);
fn token(&self) -> SignalToken;
}
pub fn signaller<'a>() -> Box<Signaller+'a> {
box SignallerImpl {
signal: Arc::new(AtomicBool::new(false))
} as Box<Signaller>
}
struct SignallerImpl {
signal: Arc<At... |
use crate::ToSql;
use std::{borrow::Cow, fmt::Debug};
use storm::{BoxFuture, Result};
use tiberius::Row;
pub trait QueryRows {
/// Execute a query on the sql server and returns the row.
///
/// ## Parameters
/// - use_transaction: make sure the query is run inside a transaction.
/// This is useful ... |
// Copyright (c) Facebook, Inc. and its affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
//! This is a structural version of the Textual language - it should have
//! basically no business logic and just provides a type-safe ... |
use std::{collections::HashMap, future::Future};
use bytes::{Buf, Bytes};
use futures::{
channel::{mpsc, oneshot},
future, FutureExt, SinkExt, StreamExt,
};
use thiserror::Error;
use tokio::io::{AsyncRead, AsyncWrite, AsyncWriteExt, DuplexStream};
use tokio_tungstenite::{tungstenite as ws, WebSocketStream};
us... |
// https://adventofcode.com/2017/day/16
#![feature(slice_rotate)]
extern crate regex;
use std::fs::File;
use std::io::prelude::*;
use regex::Regex;
use regex::RegexSet;
fn main() {
// Create needed regex for parsing input
let move_regs = RegexSet::new(&[r"s\d{1,2}", r"x\d{1,2}/\d{1,2}", r"p\D{1}/\D{1}"]).un... |
#[doc = "Register `BNDTR` reader"]
pub type R = crate::R<BNDTR_SPEC>;
#[doc = "Register `BNDTR` writer"]
pub type W = crate::W<BNDTR_SPEC>;
#[doc = "Field `BNDT` reader - block number of data to transfer"]
pub type BNDT_R = crate::FieldReader<u32>;
#[doc = "Field `BNDT` writer - block number of data to transfer"]
pub t... |
use clap::{Arg, Command};
use std::{error::Error, path::PathBuf, result::Result};
use tracing::Level;
// To run this example with the local fake GCS (see tests/resources/gcs_test.sh) instead of Google GCS,
// after starting fake-gcs-server, run this example with
// --fake-gcs-base-url http://localhost:9081
// --bu... |
#[derive(Debug, Copy, Clone)]
pub struct Material {
pub ambient: [f32; 3],
pub diffuse: [f32; 3],
pub specular: [f32; 3],
pub shininess: f32,
}
|
pub mod button;
pub mod checkbox;
pub mod container;
pub mod custom_themes;
pub mod picklist;
pub mod radio;
pub mod rule;
pub mod scrollbar;
pub mod slider;
pub mod style_constants;
pub mod svg;
pub mod text;
pub mod text_input;
pub mod types;
|
#![no_std]
use volatile_cell::VolatileCell;
// Known to apply to:
// STM32F4
ioregs!(USART = {
0x00 => reg32 sr {
0 => pe : ro,
1 => fe : ro,
2 => nf : ro,
3 => ore : ro,
4 => idle : ro,
5 => rxne : rw,
6 => tc : rw,
7 => txe : ro,
8 => lbd ... |
use byteorder::{ReadBytesExt, WriteBytesExt, NetworkEndian};
use resin::error::InternalError;
use serde::{Deserialize, Serialize};
use std::io::{self, Cursor, Read, Write};
use std::thread;
use std::time::Duration;
use std::process::{ChildStdin, Command, Stdio};
use std::sync::mpsc::{channel, Sender, Receiver};
#[cf... |
#[macro_use]
pub mod primitive;
pub mod shape;
pub mod algorithm;
|
// q0063_unique_paths_ii
struct Solution;
impl Solution {
pub fn unique_paths_with_obstacles(obstacle_grid: Vec<Vec<i32>>) -> i32 {
let mut og = obstacle_grid;
let line = og.len();
if line == 0 {
return 0;
}
let row = og[0].len();
if og[line - 1][row - 1... |
// Copyright 2021 EinsteinDB Project Authors. Licensed under Apache-2.0.
use crate::DEFAULT_RAFT_SETS;
use criterion::Criterion;
use violetabft::evioletabftpb::ConfState;
use violetabft::{storage::MemStorage, Config, VioletaBFT};
pub fn bench_violetabft(c: &mut Criterion) {
bench_violetabft_new(c);
bench_viol... |
mod account_store;
mod template_store;
pub use account_store::RocksAccountStore;
pub use template_store::RocksTemplateStore;
|
use failure::ResultExt;
use crate::{
address::{nlas::AddressNla, AddressBuffer, ADDRESS_HEADER_LEN},
traits::{Emitable, Parseable},
DecodeError,
};
#[derive(Debug, PartialEq, Eq, Clone, Default)]
pub struct AddressMessage {
pub header: AddressHeader,
pub nlas: Vec<AddressNla>,
}
#[derive(Debug, P... |
// Copyright 2018-2019 Mozilla
// 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 w... |
use sfml::graphics::{Color, Vertex, VertexArray, PrimitiveType, RenderWindow, RenderTarget};
use sfml::system::{Vector2f};
use crate::mesh::Mesh;
use crate::camera::Camera;
use crate::vector::*;
use crate::matrix::*;
use crate::light::Light;
use std::f32::consts::PI;
use std::f32;
pub fn fill_triangle(window: &RenderW... |
mod process_blockparticipants;
mod process_blocksig;
mod process_blockvss;
mod process_candidateblock;
mod process_completedblock;
pub use process_blockparticipants::process_blockparticipants;
pub use process_blocksig::process_blocksig;
pub use process_blockvss::process_blockvss;
pub use process_candidateblock::process... |
use std::convert::TryFrom;
//use crate::object;
use crate::object::{JSObject, JSRef, JSValue, Heap, Place};
use crate::error::Exception;
use crate::ast::*; // yes, EVERYTHING
// ==============================================
pub struct RuntimeState {
pub heap: Heap,
pub global_object: JSRef,
}
impl R... |
// This module and type exists to avoid parsing base urls
// every time a `*_url` method is called.
use lazy_static::lazy_static;
use url::Url;
use crate::error::{Error, Result};
const SERIES_BASE_URL: &str = "https://www.thetvdb.com/series/";
const BANNER_BASE_URL: &str = "https://www.thetvdb.com/banners/";
const G... |
use {
crate::{result::Result, SeekableVec},
::zip::{result::ZipError, write::FileOptions, CompressionMethod, ZipArchive, ZipWriter},
std::{
fs::{create_dir_all, File},
io::{self, Read, Seek, Write},
path::{Path, PathBuf},
},
walkdir::{self, WalkDir},
};
pub fn zip_app_dir(ap... |
use prelude::*;
#[no_mangle]
pub unsafe fn memset(s: *mut u8, c: i32, n: usize) -> *mut u8
{
let mut i = 0;
while i < n {
*s.offset(i as isize) = c as u8;
i += 1;
}
return s;
}
pub unsafe extern fn memmove(dest: *mut u8, src: *const u8,
n: usize) -> *mut u8 ... |
use parity_wasm::elements::*;
mod classifications;
mod errors;
use crate::classifications::*;
use crate::errors::*;
use self::Filter::*;
use std::mem::discriminant;
/*
* TODO:
* 1. Proper error propagating
* 2. Documentation
* 3. Good tests with expected failures
*/
/// Type alias representing the values poppe... |
struct Foo<'a> {
x: &'a str,
}
fn foo<'a>(p:&Foo) -> &'a str {
}
fn lifetime_block() {
let x; // -> x goes into scope
// |
{ // |
let y = "hello".to_string(); // ---> y goes into scope
let ... |
use std::collections::{BTreeMap, HashSet};
use std::ops::Index;
struct AsteroidMap {
map: Vec<MapValue>,
width: usize,
_height: usize,
}
struct AsteroidMapIter<'a> {
map: &'a AsteroidMap,
index: usize,
}
impl AsteroidMap {
fn iter(&self) -> AsteroidMapIter {
AsteroidMapIter {
... |
//! The RFC 959 Representation Type (`TYPE`) command
//
// The argument specifies the representation type as described
// in the Section on Data Representation and Storage. Several
// types take a second parameter. The first parameter is
// denoted by a single Telnet character, as is the second
// Format parameter fo... |
#![doc = "generated by AutoRust 0.1.0"]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(unused_imports)]
use crate::models::*;
use reqwest::StatusCode;
use snafu::{ResultExt, Snafu};
pub mod authorization_operations {
use crate::models::*;
use reqwest::StatusCode;
use snafu::{ResultExt, Snafu};
... |
/// An enum to represent all characters in the Ogham block.
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)]
pub enum Ogham {
/// \u{1680}: ' '
SpaceMark,
/// \u{1681}: 'ᚁ'
LetterBeith,
/// \u{1682}: 'ᚂ'
LetterLuis,
/// \u{1683}: 'ᚃ'
LetterFearn,
/// \u{1684}: 'ᚄ'
LetterSail,
... |
use crate::core;
use crate::core::Karta;
use std::cmp::Ordering;
use std::sync::{Arc, Mutex};
use std::collections::BinaryHeap;
use std::time;
pub enum Status {
Ready,
Next(time::Duration),
NoTask
}
#[derive(Clone)]
struct Task {
time: u64,
karta: Arc<Mutex<dyn Karta>>,
}
impl Ord for Task {
... |
use crate::ALLOCATOR;
use alloc::string::String;
#[inline(always)]
fn sys_call(
syscall_id: SyscallId,
arg0: usize,
arg1: usize,
arg2: usize,
arg3: usize,
arg4: usize,
arg5: usize,
) -> i32 {
let id = syscall_id as usize;
let mut ret: i32;
let failed: i32;
unsafe {
... |
// MIT License
//
// Copyright (c) 2021 Miguel Peláez
//
// 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 restriction, including without limitation the rights
// to use, copy, modif... |
use fyrox::event::VirtualKeyCode;
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
pub enum ControlButton {
Mouse(u16),
Key(VirtualKeyCode),
WheelUp,
WheelDown,
}
impl ControlButton {
pub fn name(self) -> &'static str {
match self {
ControlButton::Mouse(index) => match index {
... |
use std::cell::{RefCell, RefMut};
use std::fs::{create_dir_all, File, OpenOptions};
use std::io::Write;
use std::path::Path;
use std::sync::{Arc, Mutex};
use std::time::SystemTime;
use chrono::Local;
use log::{Level, Log, Metadata, Record, SetLoggerError};
struct FileRotateLoggerRuntime {
pub current_rotate: i32,... |
use std::str::from_utf8;
use std::process::Output;
use std::io;
use std::fmt;
use std::time::SystemTime;
#[cfg(test)]
pub mod fake;
pub mod util;
pub mod real;
#[derive(Debug)]
pub struct CommandLineOutput
{
pub out : String,
pub err : String,
pub code : Option<i32>,
pub success : bool,
}
#[derive(De... |
// use std::f64::consts;
use std::ops::Mul;
trait HasArea<T> {
fn area(&self) -> T;
}
// struct Circle<T> {
// radius: T,
// }
//
// impl<T> HasArea<T> for Circle<T>
// where T: Mul<Output=T> + Copy {
// fn area(&self) -> T {
// consts::PI * (self.radius * self.radius)
// }
// }
struct Squar... |
use super::Result;
use crate::model::Product;
pub trait ProductService: Send + Sync {
fn get_products_by_wishlist_id(&self, wishlist_id: &str) -> Result<Vec<Product>>;
fn get_archived_products(&self, page: usize, per_page: usize) -> Result<Vec<Product>>;
}
|
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct GitObject {
pub sha: Option<String>,
#[serde(rename = "type")]
pub type_: Option<String>,
pub url: Option<String>,
}
impl GitObject {
/// Create a builder for this object.
#[inline]
pub fn builder() -> GitObjectBuilder {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.