text stringlengths 8 4.13M |
|---|
use crate::{
protocol,
types::{ChannelId, FrameSize, Heartbeat},
};
use parking_lot::RwLock;
use std::{fmt, sync::Arc};
#[derive(Clone, Default)]
pub struct Configuration {
inner: Arc<RwLock<Inner>>,
}
impl Configuration {
pub fn channel_max(&self) -> ChannelId {
self.inner.read().channel_max
... |
#![doc = "generated by AutoRust 0.1.0"]
#![allow(non_camel_case_types)]
#![allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Trial {
#[serde(skip_serializing)]
pub status: Option<trial::Status>,
#[serde(rename = "availableHosts"... |
struct Solution;
use std::cmp::{Ordering, Reverse};
use std::collections::{BinaryHeap, HashMap};
#[derive(Eq)]
struct Element {
value: i32,
rate: u32,
}
impl Ord for Element {
fn cmp(&self, other: &Self) -> Ordering {
self.rate.cmp(&other.rate)
}
}
impl PartialOrd for Element {
fn partia... |
#![cfg_attr(nightly, deny(missing_docs))]
#![cfg_attr(nightly, feature(external_doc))]
#![cfg_attr(nightly, doc(include = "../README.md"))]
#![cfg_attr(test, deny(warnings))]
mod bitfield;
mod change;
pub use crate::bitfield::Bitfield;
pub use crate::change::Change;
|
// Copyright 2021 The Matrix.org Foundation C.I.C.
//
// 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... |
//! NMEA is the sentence format for receiving data from a GPS.
//!
//! # GPS outputs
//! ## GPS sentence outputs.
//! - GGA -> UTC, Latitude, Longitude, Position fix (GPS, DGPS, No fix), sats used, HDOP, altitude, Geoidal Seperation, Age of diff corr
//! - VTG -> Course (true), Course (magnetic), speed knots, speed kph... |
// Copyright (c) 2021 Thomas J. Otterson
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
use crate::{
components::pin::{Mode, Pin},
vectors::RefVec,
};
#[inline]
pub fn pins_to_value(pins: &RefVec<Pin>) -> usize {
let mut value = 0;
for (i, pin) in pins.it... |
// Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{
core_mempool::{CoreMempool, TimelineState},
mempool_service::MempoolService,
proto::mempool::*,
proto::mempool_client::MempoolClientWrapper,
};
use libra_config::config::NodeConfig;
use libra_crypto::ed2551... |
use crate::drawer::DrawerCommand;
use crate::event_emitter::EventEmitterCommand;
use glium::glutin::event_loop::ControlFlow;
use sodium_rust::Stream;
pub struct Output<CustomEvent>
where
CustomEvent: Clone + Send + Sync + 'static,
{
pub control_flow: Stream<ControlFlow>,
pub drawer_command: Stream<DrawerCo... |
use amethyst::{
assets::ProgressCounter,
core::{
nalgebra::Vector3,
transform::components::{Parent, Transform},
},
ecs::prelude::*,
renderer::{Transparent,Flipped},
};
use crate::{
components::{physics::PhysicalProperties, IsIngameEntity},
entities::{EntityError, EntitySprit... |
use anyhow::{format_err, Error};
use stack_string::{format_sstr, StackString};
use std::path::Path;
use url::Url;
use gdrive_lib::storage_v1_types::Object;
use crate::{
file_info::{FileInfo, FileInfoTrait, FileStat, Md5Sum, Sha1Sum},
file_service::FileService,
};
#[derive(Debug, Default, Clone)]
pub struct F... |
#[cfg(test)]
#[path = "../../tests/unit/constraints/breaks_test.rs"]
mod breaks_test;
use crate::constraints::*;
use hashbrown::HashSet;
use std::slice::Iter;
use std::sync::Arc;
use vrp_core::construction::constraints::*;
use vrp_core::construction::heuristics::{ActivityContext, RouteContext, SolutionContext};
use vr... |
use std::cmp::Ordering;
use crate::ast::ast::ASTNode;
use crate::ast::dec::{DecData, DecList};
use crate::wasm::il::module::ModuleList;
use super::semantic_param::SemanticParam;
use super::trans_dec::trans_dec;
pub fn trans_ast(tree: ASTNode) -> (ModuleList, i32) {
match tree {
ASTNode::DecList(declist) ... |
pub mod chart;
pub mod config;
pub mod hook;
pub mod info;
pub mod metadata;
pub mod release;
pub mod rudder;
pub mod rudder_grpc;
pub mod status;
pub mod template;
pub mod test_run;
pub mod test_suite;
pub mod tiller;
pub mod tiller_grpc;
pub mod version;
|
use crate::string_var::StringVar;
use ascii::{AsAsciiStr, AsciiChar, AsciiStr, AsciiString, ToAsciiChar};
use std::fmt::{self, Display, Formatter};
use std::hash::{Hash, Hasher};
use std::mem::take;
use std::ops::{Add, AddAssign, Deref};
#[derive(Debug, Copy, Clone)]
pub enum MaybeAscii<'a> {
Standard(&'a str),
... |
use serde::{self,Deserialize};
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct Country {
pub id: String,
pub name: String,
pub capital_city: String,
pub longitude: String,
pub latitude: String
}
|
use std::fs;
use std::path::{Path, PathBuf};
use std::sync::{Arc, RwLock};
use slog::{info, Drain, Level, Logger};
mod configuration;
mod filters;
mod handlers;
mod node_runner;
mod tezos_client_runner;
const TEZOS_CLIENT_DIR: &str = "./tezos-client";
#[tokio::main]
async fn main() {
// parse and validate progr... |
/// An enum to represent all characters in the Arrows block.
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)]
pub enum Arrows {
/// \u{2190}: '←'
LeftwardsArrow,
/// \u{2191}: '↑'
UpwardsArrow,
/// \u{2192}: '→'
RightwardsArrow,
/// \u{2193}: '↓'
DownwardsArrow,
/// \u{2194}: '↔'
... |
use std::{iter, mem};
fn main() {
let _example = (b"389125467", 10, 9); // 92658374
let _example2 = (b"389125467", 100, 9); // 67384529
let _task = (b"583976241", 10_000_000, 1_000_000);
let (input, cycles, cups_count) = _task;
let mut next_cup: Vec<_> = (0..cups_count).map(|cup| (cup + 1) % cups_... |
//! This example demonstrates a [`PoolTable`] usage.
use tabled::{
settings::{Alignment, Style},
tables::PoolTable,
};
fn main() {
let characters = [
"Naruto Uzumaki",
"Kakashi Hatake",
"Minato Namikaze",
"Jiraiya",
"Orochimaru",
"Itachi Uchiha",
];
... |
use crate::file::{validate_directory_exists, validate_file_exists};
use chrono::NaiveDateTime;
use exif::{Exif, In, Tag};
use once_cell::unsync::OnceCell;
use std::ffi::OsStr;
use std::fs::{copy, File};
use std::io::{BufReader, Error, ErrorKind, Result};
use std::path::{Path, PathBuf};
pub struct Photo {
path: Pat... |
table! {
links (id) {
id -> Int4,
shortened -> Varchar,
original -> Text,
created_at -> Timestamp,
}
}
|
use crate::ils;
use crate::santa::{FamilyData, Solution};
use crate::solution_queue::SolutionQueue;
use std::sync::{Arc, Mutex};
use std::thread;
pub struct MonteCarloSearch {
families: FamilyData,
reps_per_sol: usize,
nthreads: usize,
move_depth: usize,
outdir: String,
nperturbations: usize,
}... |
extern crate futures;
extern crate gotham;
extern crate gotham_middleware_tokio;
extern crate hyper;
extern crate mime;
extern crate tokio_core;
use futures::{future, Future, Stream};
use gotham::handler::{HandlerFuture, NewHandlerService};
use gotham::router::builder::{build_router, DefineSingleRoute, DrawRoutes};
us... |
use rowan::*;
use crate::TokenInfo;
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
enum SyntaxKind {
IntLiteral,
FloatLiteral,
BinaryExpression,
Class,
Function,
}
trait AstNode {
}
enum JavaTypes {}
impl rowan::Types for JavaTypes {
/// Each node will store a `Kind`.
type Kind = SyntaxKi... |
use std::{collections::BTreeMap};
use crate::{in_memory_room::InMemoryRoom, room::{Room, Spells}, scenario::*, waiting::{GodWayRef, PlayerId}};
use super::{play::*};
use crate::elections::ballot::Ballots;
use rand::{prelude::SliceRandom, thread_rng};
pub struct Classic {
room: InMemoryRoom,
state: CityState... |
// q0091_decode_ways
struct Solution;
const VALID_CODE: [&str; 26] = [
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17",
"18", "19", "20", "21", "22", "23", "24", "25", "26",
];
impl Solution {
pub fn num_decodings(s: String) -> i32 {
let slen = s.len();... |
// Super WIPy sixel parser
// Works in the few test cases I tried at least
#[derive(Copy, Clone, Debug)]
pub struct HeaderParser {
macro_param: usize,
transparent_bg: bool,
grid_size: usize,
aspect_numerator: usize,
aspect_denominator: usize,
xsize: usize,
ysize: usize,
state: HeaderPar... |
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0.
use std::fmt::{self, Debug, Display, Formatter};
use kvproto::kvrpcpb::{CommandPri, Context, GetRequest, RawGetRequest};
use tikv_util::collections::HashMap;
use txn_types::{Key, Lock, Mutation, TimeStamp};
use crate::storage::lock_manager::WaitTimeo... |
#[doc = "Reader of register ICENABLER2"]
pub type R = crate::R<u32, super::ICENABLER2>;
#[doc = "Writer for register ICENABLER2"]
pub type W = crate::W<u32, super::ICENABLER2>;
#[doc = "Register ICENABLER2 `reset()`'s with value 0"]
impl crate::ResetValue for super::ICENABLER2 {
type Type = u32;
#[inline(always... |
//! Textures.
//!
//! A texture is just some function that makes the colors on a surface
//! procedural. So, rather than have a bunch of structs floating around, this
//! module mostly contains functions that return `Texture` functions.
pub mod constant;
pub use constant::constant;
pub mod checkerboard;
pub use check... |
mod front_of_house;
pub use crate::front_of_house::hosting;
fn eat_at_the_restaurant() {
hosting::add_to_waitlist();
hosting::add_to_waitlist();
hosting::add_to_waitlist();
}
|
use kerla_runtime::{address::UserVAddr, arch::PAGE_SIZE};
global_asm!(include_str!("usermode.S"));
mod arch_prctl;
mod process;
pub const KERNEL_STACK_SIZE: usize = PAGE_SIZE * 256;
pub const USER_VALLOC_END: UserVAddr = unsafe { UserVAddr::new_unchecked(0x0000_0fff_0000_0000) };
pub const USER_VALLOC_BASE: UserVAdd... |
use rand::{prelude::Distribution, Rng};
use serde::{Deserialize, Serialize};
pub fn generate_random_id() -> String {
return rand::thread_rng()
.sample_iter(Omeglenumeric)
.take(8)
.map(char::from)
.collect();
}
// implementation was straight up copied from Alphanumeric implementati... |
/// A String wrapper that repeats itself count times when converted into a String
pub struct Padding {
string: String,
count: usize
}
impl std::fmt::Display for Padding {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
for _ in 0..self.count {
write!(f, "{}", self.strin... |
//! Tests auto-converted from "sass-spec/spec/directives/if"
#[allow(unused)]
use super::rsass;
mod error;
// From "sass-spec/spec/directives/if/escaped.hrx"
mod escaped {
#[allow(unused)]
use super::rsass;
#[test]
fn if_only() {
assert_eq!(
rsass(
"// Escapes should be nor... |
// This file is part of Substrate.
// Copyright (C) 2017-2022 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// 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
//
// ht... |
// Problem 1 - Multiples of 3 and 5
//
// If we list all the natural numbers below 10 that are multiples of 3 or 5, we
// get 3, 5, 6 and 9. The sum of these multiples is 23.
//
// Find the sum of all the multiples of 3 or 5 below 1000.
fn main() {
println!("{}", solution());
}
fn solution() -> i32 {
(1..1000... |
pub const DEFAULT_PROFILE_IDX: usize = 0;
|
pub use linux_macros::{PodPub as Pod};
pub unsafe trait Pod: Copy {
fn _assert_pod() { }
}
macro_rules! i {
($t: ty) => {
unsafe impl Pod for $t { }
};
}
i!(u8);
i!(i8);
i!(u16);
i!(i16);
i!(u32);
i!(i32);
i!(u64);
i!(i64);
i!(usize);
i!(isize);
macro_rules! j {
($n:expr) => {
unsafe... |
use core::marker::PhantomData;
use embassy::util::Unborrow;
use embassy_extras::unborrow;
use gpio::Pin;
use crate::{gpio, pac, peripherals};
#[non_exhaustive]
pub struct Config {
pub baudrate: u32,
pub data_bits: u8,
pub stop_bits: u8,
}
impl Default for Config {
fn default() -> Self {
Self... |
fn get_cell_number(x: usize, y: usize) -> usize {
let mut pos = (1, 1);
let mut counter = 1;
loop {
if pos == (x, y) {
break;
}
counter += 1;
if pos.0 == 1 {
pos.0 = pos.1 + 1;
pos.1 = 1;
} else {
pos.0 -= 1;
... |
// disable console opening on windows
#![windows_subsystem = "windows"]
use bevy::prelude::{App, Msaa, WindowDescriptor};
use bevy::DefaultPlugins;
use the_cleanup_plugin::GamePlugin;
fn main() {
let mut app = App::build();
app.insert_resource(Msaa { samples: 4 })
.insert_resource(WindowDescriptor {
... |
use teloxide::{prelude::*, types::CallbackQuery};
use super::util::toggle_reaction;
pub async fn handle_callback_query(cx: UpdateWithCx<CallbackQuery>) -> anyhow::Result<()> {
let query = cx.update;
let msg = if let Some(msg) = query.message {
msg
} else {
cx.bot
.answer_callb... |
use serde::{Deserialize, Serialize};
use uuid::Uuid;
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct RequestPayload {
// Creation Request must begin with the partner ID followed by a -
pub(crate) creation_request_id: String,
pub(crate) partner_id: String,
pub(crat... |
/// CreateUserOption create user options
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct CreateUserOption {
pub email: String,
pub full_name: Option<String>,
pub login_name: Option<String>,
pub must_change_password: Option<bool>,
pub password: String,
pub send_notify: Option... |
extern crate proc_macro;
use crate::proc_macro::TokenStream;
use i18n_config::I18nConfig;
use quote::quote;
use std::path::PathBuf;
/// A procedural macro to implement the `I18nEmbed` trait on a struct.
#[proc_macro_derive(I18nEmbed)]
pub fn i18n_embed_derive(input: TokenStream) -> TokenStream {
let ast: syn::De... |
use crate::{
fragment,
map::{ASCII_PROPERTIES, UNICODE_FRAGMENTS},
Cell, Fragment, FragmentBuffer, Merge,
};
pub use property::{Property, Signal};
use std::collections::HashMap;
mod property;
/// PropertyBuffer is a buffer
/// which contains the property of each cell
/// This will be used in the first pha... |
use special_map::BidirRemovableMap;
use specs::Entity;
use fnv::FnvBuildHasher;
#[derive(Debug, Default)]
pub struct PlayerNames(pub BidirRemovableMap<String, Entity, FnvBuildHasher>);
|
// q0077_combinations
struct Solution;
// impl Solution {
// pub fn combine(n: i32, k: i32) -> Vec<Vec<i32>> {
// let mut ret = vec![];
// let ref mut tmpv = vec![];
// let ref mut picked = vec![false; n as usize];
// Solution::c(n, k, picked, tmpv, &mut ret);
// ret
// ... |
//! Constants representing various RDF class hierarchies and instances from the LV2 standard.
// TODO: Explore possibility of generating some of the information in this module automatically at
// build time, maybe using macros and/or RDF?
/// Identifiers for standard LV2 plugin classes.
///
/// This type's implementa... |
use serde::{Deserialize, Serialize};
use super::{column_constraints::ColumnConstraints, column_data_type::ColumnDataType};
/// Column definition used in DDL.
#[derive(Clone, Eq, PartialEq, Hash, Debug, Serialize, Deserialize, new)]
pub struct ColumnDefinition {
column_data_type: ColumnDataType,
column_constra... |
use std::iter::FromIterator;
use crate::{grid::records::vec_records::CellInfo, Table};
use super::IndexBuilder;
/// Builder creates a [`Table`] from dynamic data set.
///
/// It useful when the amount of columns or rows is not known statically.
///
/// ```rust
/// use tabled::builder::Builder;
///
/// let mut builde... |
use super::mutator::ALLOCATOR_MAPPING;
use super::{
gc_work::{GenCopyCopyContext, GenCopyMatureProcessEdges, GenCopyNurseryProcessEdges},
LOGGING_META,
};
use crate::plan::global::BasePlan;
use crate::plan::global::CommonPlan;
use crate::plan::global::GcStatus;
use crate::plan::AllocationSemantics;
use crate::p... |
// Exercises 1&2 (p.13 of the book)
const SAMPLES_NUM: u32 = 5000;
const INTERVALS_NUM: usize = 50;
const B_INIT_DEFAULT: f32 = 0.123;
use arsak_zhak_programmirovanie_igr_i_golovolomok::*;
use std::env;
use std::str::FromStr;
// Run as exc1 [initial_seed [randomization_param]]
fn main() {
let args: Vec<String> =... |
// Copyright 2020 The VectorDB Authors.
//
// Code is licensed under Apache License, Version 2.0.
pub mod parser;
pub mod planner;
pub mod constant;
pub mod expressions;
pub mod filter;
pub mod map;
pub mod select;
pub mod source;
pub mod variable;
pub use self::constant::ConstantPlanner;
pub use self::filter::Filte... |
#![feature(
i128_type,
rustc_private,
)]
// From rustc.
#[macro_use]
extern crate log;
extern crate log_settings;
#[macro_use]
extern crate rustc;
extern crate rustc_const_math;
extern crate rustc_data_structures;
extern crate syntax;
// From crates.io.
extern crate byteorder;
mod cast;
mod const_eval;
mod e... |
//! SNASM, a SNES assembler/disassembler and patch generation tool.
#![deny(missing_docs)]
#![deny(unused)]
#![deny(warnings)]
#![deny(unsafe_code)]
pub mod asm;
pub mod dis;
pub mod error;
pub mod int;
pub mod isa;
pub mod link;
pub mod obj;
pub mod rom;
pub mod syn;
|
pub mod positive_negative_number_check;
pub mod resturnet_practice;
pub mod string_multirun;
pub mod my_way_of_pattren;
pub mod dynamic_fibonacci_series; |
#![deny(rust_2018_idioms)]
//! # HttpRouter
//!
//! [](https://docs.rs/httprouter/0.5.0)
//! [](https://crates.io/crates/httprouter)
//! []
pub enum Error {
ExpectedSymbol(Scm),
ExpectedList(Scm),
InvalidForm(Scm),
NoSuchVariable(Symbol),
ImmutableVariable(Symbol),
IncorrectArity(Scm, usize),
TooFewArguments(Scm),
TooManyA... |
fn main() {
fn dupe(data: &'static mut u8) -> (&'static mut u8, &'static mut u8) {
(data, data) //~ ERROR cannot borrow
}
let _ = dupe;
}
|
/* Our Crate */
use day_2::IntcodeMachine;
/* Standard Library */
use std::fs::File;
use std::io::Read;
#[test]
/* Takes the input and calculates the final result of position 0 */
fn determine_inputs() -> Result<(), String> {
/* Read and parse the file */
let mut file = File::open("input.txt").unwrap();
l... |
mod alert;
mod block_template;
mod blockchain;
mod bytes;
mod cell;
mod chain_info;
mod experiment;
mod fixed_bytes;
mod indexer;
mod net;
mod pool;
mod primitive;
mod proposal_short_id;
mod sync;
mod uint128;
mod uint32;
mod uint64;
pub use self::alert::{Alert, AlertMessage};
pub use self::block_template::{
Block... |
extern crate futures;
extern crate hyper;
extern crate hyper_tls;
extern crate tokio;
#[macro_use(values_t, value_t, crate_version, crate_authors)]
extern crate clap;
use clap::{App, Arg, ArgMatches};
use futures::stream::Stream;
use hyper::Body;
use hyper::{Client, Request};
use std::fs::read_to_string;
use std::fs:... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
_reserved_0_gicd: [u8; 4usize],
#[doc = "0x04 - GICD interrupt controller type register"]
pub gicd_typer: GICD_TYPER,
#[doc = "0x08 - GICD implementer identification register"]
pub gicd_iidr: GICD_IIDR,
_reserved3: [u8; 116usize],
... |
#![allow(non_camel_case_types)]
#[cfg(target_arch = "aarch64")]
use core::arch::aarch64::*;
use core::mem::transmute;
// TODO: 等待 stdarch 项目增加 这个类型。
type poly128_t = u128;
#[inline]
unsafe fn vreinterpretq_u8_p128(a: poly128_t) -> uint8x16_t {
transmute(a)
}
// NOTE: 不同编译器的优化:
// https://gist.github.com/LuoZijun... |
extern crate codeforces;
use std::io::Read;
fn get_auth() -> Result<(String, String), std::env::VarError> {
let user = std::env::var("CFRS_USER")?;
let pass = std::env::var("CFRS_PASS")?;
Ok((user, pass))
}
fn main() {
let (user, pass) = get_auth().expect("failed to get environment variables CFRS_USER and CFRS_P... |
//! Passphrase generation with basic configuration
//!
//! This example shows how to use the [`BasicConfig`](config::BasicConfig) structure for
//! configuring how passphrases should be generated. See the [`BasicConfig`](config::BasicConfig)
//! documentation for all available options.
//!
//! Other configuration struc... |
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Name {
name: String,
}
impl Name {
pub fn new(name: String) -> Option<Self> {
for chr in name.chars() {
if !chr.is_alphabetic() && chr != '_' {
return Option::None;
}
}
Option::Some(Name {... |
// Copyright 2018 pdb Developers
//
// 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 except according to tho... |
extern crate quackngo;
#[macro_use]
extern crate log;
extern crate env_logger;
extern crate clap;
use clap::{Arg, App}; //, SubCommand};
// // &t=user-agent
//
// // -type A/C/N/E - return 1 if nothing
// // -count N - return how many records, default is all
// // Abstracts and categories
// // - -... |
extern crate pancurses;
use super::irc::Command as IrcCommand;
use super::{irc, ui, Config};
// TODO determine if these need to exist
pub mod messagequeue;
pub use self::messagequeue::*;
pub mod boundedset;
pub use self::boundedset::*;
import!(
buffer, //
colors, //
commands, //
events, //
... |
use crate::endpoint;
use crate::num::model::{RequestParameters, Response};
pub async fn get(query: &RequestParameters) -> Result<Response, Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let resp = client.get(endpoint::NUM).query(query).send().await?;
//let status = resp.status();
... |
use crate::api::User;
use crate::kubernetes::{Engine, InstanceDetails, PodDetails};
use crate::metrics::Metrics;
use crate::template::Template;
use log::{error, warn};
use serde::{Deserialize, Serialize};
use std::{
collections::BTreeMap,
error::Error,
sync::{Arc, Mutex},
thread::{self, JoinHandle},
... |
// Copyright 2019 EinsteinDB Project Authors. Licensed under Apache-2.0.
use crate::test_util::*;
use fail;
use violetabft::{evioletabftpb::MessageType, util::default_logger};
use std::sync::*;
// test_reject_stale_term_message tests that if a server receives a request with
// a stale term number, it rejects the requ... |
fn main() {
const MAX_POINTS: u32 = 100_000;
println!("The value of MAX_POINTS is: {}", MAX_POINTS);
let mut x = 5;
println!("The value of x is: {}", x);
// Modifies existing x variable in place
x = 6;
println!("The value of x is: {}", x);
let y = 5;
println!("The value of y is... |
//! Diagnostic data structures.
use codespan::{FileId, Span};
#[cfg(feature = "serialization")]
use serde::{Deserialize, Serialize};
use std::cmp::Ordering;
/// A severity level for diagnostic messages.
///
/// These are ordered in the following way:
///
/// ```rust
/// use codespan_reporting::diagnostic::Severity;
/... |
#[doc = "Register `CRL` reader"]
pub type R = crate::R<CRL_SPEC>;
#[doc = "Register `CRL` writer"]
pub type W = crate::W<CRL_SPEC>;
#[doc = "Field `SECF` reader - Second Flag"]
pub type SECF_R = crate::BitReader<SECFR_A>;
#[doc = "Second Flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ... |
#![allow(dead_code)]
use alloc::vec::Vec;
use crate::Checksum256;
fn make_canonical_left(val: &Checksum256) -> Checksum256 {
let mut canonical_l: Checksum256 = *val;
canonical_l.set_hash0(canonical_l.hash0() & 0xFFFFFFFFFFFFFF7Fu64);
canonical_l
}
fn make_canonical_right(val: &Checksum256) -> Checksum256... |
extern crate adafruit_gps;
use std::env;
use adafruit_gps::{Gps};
use adafruit_gps::set_baud_rate;
fn main() {
// These args are just for easy testing for what baud rate and what update rate you want work.
let args: Vec<String> = env::args().collect();
let baud_rate = args.get(1).unwrap();
let updat... |
pub use self::func::Function;
pub use self::variable::GlobalVariable;
pub mod func;
pub mod variable;
use ir::GlobalValue;
pub struct GlobalObject<'ctx>(GlobalValue<'ctx>);
impl_subtype!(GlobalObject => GlobalValue);
|
#[doc = "Register `SECCCR` writer"]
pub type W = crate::W<SECCCR_SPEC>;
#[doc = "Field `CLR_EOP` writer - EOP flag clear bit Setting this bit to 1 resets to 0 EOP flag in FLASH_SECSR register."]
pub type CLR_EOP_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>;
#[doc = "Field `CLR_WRPERR` writer - WRPERR flag cle... |
//NOTE: Needs testing based on: https://i.stack.imgur.com/bnwoo.png
//Gotten from: https://stackoverflow.com/questions/1472514/convert-light-frequency-to-rgb
pub fn wavelength_to_rgb(wavelength: f32) -> [f32; 3] {
let mut red: f32 = 0.0;
let mut green: f32 = 0.0;
let mut blue: f32 = 0.0;
if wavelength ... |
use nix::fcntl::{open, OFlag};
use nix::sys::stat::Mode;
use nix::sys::wait::{waitpid, WaitStatus};
use nix::unistd::{chdir, close, dup2, execvp, fork, pipe, ForkResult, Pid};
use std::env::current_dir;
use std::ffi::CString;
use std::io;
use std::io::prelude::*;
use std::io::{BufReader, BufWriter};
use std::process::e... |
// ---------------------------------------------------------------------
// ZeroConf config resolver
// ---------------------------------------------------------------------
// Copyright (C) 2007-2021 The NOC Project
// See LICENSE for details
// ---------------------------------------------------------------------
us... |
#[cfg(test)]
mod tests {
extern crate oqs;
extern crate rustc_serialize;
use self::oqs::*;
use self::rustc_serialize::hex::{ToHex, FromHex};
#[test]
fn basic_kyber_test() {
let kemalg = kem::Kem::new(kem::Algorithm::Kyber1024).unwrap();
let (kem_pk, kem_sk) = ... |
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// # Nombre: Daniela Guadalupe Ramirez Castillo #
// # Matricula: 170659 #
// # Carrera: ITI ... |
fn forward_multiply_gate(x: f64, y: f64) -> f64 {
return x * y
}
pub fn main() {
let mut x: f64 = -2.0;
let mut y: f64 = 3.0;
let mut output = forward_multiply_gate(x, y);
let mut x_gradient: f64 = y;
let mut y_gradient: f64 = x;
let step_size: f64 = 0.01;
x += step_size * x_gradie... |
use std::sync::Arc;
use chrono::{Datelike, Utc};
use eyre::Report;
use rosu_pp::{Beatmap, BeatmapExt, PerformanceAttributes};
use rosu_pp_older::*;
use rosu_v2::prelude::{GameMode, OsuError, Score};
use twilight_model::{
application::{
command::CommandOptionChoice,
interaction::{
applic... |
use core::{
assets::{
asset::{Asset, AssetId},
protocol::{AssetLoadResult, AssetProtocol, AssetVariant, Meta},
},
Ignite, Scalar,
};
use serde::{Deserialize, Serialize};
use std::{any::Any, str::from_utf8};
#[derive(Ignite, Debug, Clone, Serialize, Deserialize)]
pub struct FontFace {
pu... |
// #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)]
// #[serde(rename_all = "camelCase")]
// pub struct Collections {
// pub field_data_collection: Vec<FieldDataCollection>,
// }
// #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Des... |
use core::cell::{RefCell};
use cortex_m::interrupt::{free, Mutex, CriticalSection};
use core::ops::DerefMut;
use crate::leds::do_led_command;
#[derive(Copy, Clone)]
pub(crate) struct CommandParser {
parser_state: CommandParserState,
led_number: u8,
led_command: CommandLEDType,
}
pub(crate) struct Comma... |
use std::net::TcpStream;
use std::io::{Result};
use time;
use client::connection::Connection;
const BUFFER_SIZE: usize = 1024 * 1024;
pub struct TestClient {
con: Connection
}
// The intention is that the client is silent, and any output is done by who invokes it
impl TestClient {
pub fn new(server: &str, po... |
// Copyright 2015 Remi Rampin
// From wikipedia:
// http://en.wikipedia.org/?title=BMP_file_format&oldid=653744490#Example_1
//! This module implements drawing on a bitmap file in memory, and writing that
//! bitmap to disk in BMP format.
use std::fs::File;
use std::io;
use std::io::{BufWriter, Write};
use std::path:... |
use crate::Entity;
pub trait EntityOf {
type Entity: Entity;
}
|
use serde_derive::Deserialize;
#[derive(Deserialize, Debug)]
pub struct Config {
#[serde(rename(deserialize = "healthcheck"))]
pub health_check: healthcheck::config::HealthCheck,
}
|
use crate::gatt::*;
use crate::interfaces::*;
use crate::introspect::*;
use crate::*;
use nix::errno::Errno;
use nix::poll;
use nix::sys::socket;
use nix::sys::time::{TimeVal, TimeValLike};
use nix::sys::uio::IoVec;
use nix::unistd::close;
use rustbus::params::{Base, Container, Param};
use rustbus::wire::marshal::trait... |
use crate::hal::{
gpio::{p0, Floating, Input, Pin},
gpiote::GpioteChannel,
pac,
prelude::{InputPin, _embedded_hal_adc_OneShot as OneShot},
saadc::{self, Saadc, SaadcConfig},
};
use pinetime_common::{BatteryControllerExt, MilliVolts};
use rtic::time::duration::Milliseconds;
/// High = battery, Low =... |
#[cfg(all(target_os = "macos", feature = "macos"))]
pub mod macos;
#[cfg(feature = "prefix")]
pub mod prefix;
#[cfg(all(windows, feature = "windows"))]
pub mod windows;
use std::collections::BTreeMap;
use std::fmt::Debug;
use std::path::{Path, PathBuf};
use std::pin::Pin;
use std::sync::{Arc, RwLock};
use hashbrown::... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.