text stringlengths 8 4.13M |
|---|
//! ARM64 drivers
pub use self::board::serial;
use super::board;
/// Initialize ARM64 common drivers
pub fn init() {
board::init_driver();
crate::drivers::console::init();
}
|
use std::time::SystemTime;
use ::rand::SeedableRng;
use kiss3d::{
light::Light,
nalgebra::{Translation, UnitQuaternion, Vector3},
window::Window,
};
use macroquad::prelude::*;
use rand_chacha::ChaCha8Rng;
use spawners::*;
use sprites::Sprites;
use systems::*;
mod ai_person;
mod building;
mod components;
m... |
use engine::Event;
pub trait Input {
fn next_event(&mut self) -> Event;
} |
use async_trait::async_trait;
use bonsaidb_core::{
custom_api::CustomApi,
kv::Kv,
networking::{DatabaseRequest, DatabaseResponse, Request, Response},
schema::Schema,
};
#[async_trait]
impl<DB, A> Kv for super::RemoteDatabase<DB, A>
where
DB: Schema,
A: CustomApi,
{
async fn execute_key_oper... |
use crate::first;
use crate::method::StdMethod;
use crate::name::Name;
use crate::operator::Operator;
use crate::runtime::Runtime;
use crate::string_var::StringVar;
use crate::variable::{FnResult, OptionVar, Variable};
pub fn str(this: OptionVar, runtime: &mut Runtime) -> Result<StringVar, ()> {
Result::Ok(if this... |
// Copyright 2020 The VectorDB Authors.
//
// Code is licensed under Apache License, Version 2.0.
use crate::datums::Datum;
use crate::errors::Error;
use super::*;
pub trait IExpression {
fn eval(&self) -> Result<Datum, Error>;
}
pub enum Expression {
Constant(ConstantExpression),
Variable(VariableExpre... |
// mod ptrs;
use std::fmt;
use std::mem;
#[macro_use]
extern crate log;
pub trait Dict<T> {
type K;
fn empty() -> Self;
fn insert(&mut self, key: Self::K, val: T);
fn remove(&mut self, key: &Self::K) -> Option<T>;
fn lookup(&self, key: &Self::K) -> Option<&T>;
}
#[derive(Clone,Debug,PartialOrd,Or... |
use std::path::*;
use std::env::Args;
use std::process::Command;
use std::os::unix::prelude::CommandExt;
use crate::config;
pub fn run(bin: &str, args: Args) {
// no -c argument available in this case
let erl_dir = config::erl_to_use();
let cmd = Path::new(&erl_dir).join("bin").join(bin);
debug!("run... |
//! Module for all game lobby code. The Lobby represents the interface between
//! the actual game, the database, and player connections.
mod client;
mod lobby_impl;
use crate::game::{snapshot::GameSnapshot, Action, Message};
pub use lobby_impl::Lobby;
use serde::{Deserialize, Serialize};
use thiserror::Error;
use to... |
/*!
```rudra-poc
[target]
crate = "livesplit-core"
version = "0.11.0"
[report]
issue_url = "https://github.com/LiveSplit/livesplit-core/issues/400"
issue_date = 2021-01-26
[[bugs]]
analyzer = "UnsafeDataflow"
bug_class = "UninitExposure"
bug_count = 2
rudra_report_locations = [
"src/run/parser/llanfair.rs:42:1: 5... |
use super::MacroValue;
use std::fs::File;
use std::error::Error;
use std::io::prelude::*;
pub fn include(params: Vec<MacroValue>) -> Result<MacroValue, Box<Error>> {
assert!(params.len() == 1);
let mut file = File::open(params[0].clone().try_as_string()?)?;
let mut buffer = String::new();
file.read_to_string(&m... |
use crate::models::{Item, ItemColor, ItemId, ItemImageList, ItemType, RelatedItem};
use actix_web::{error, web, HttpResponse, Result};
use anyhow::anyhow;
use database::models::{
Comic as DatabaseComic, Item as DatabaseItem, RelatedItem as RelatedDatabaseItem,
};
use database::DbPool;
use std::convert::{TryFrom, Tr... |
use crate::{
exec::Interpreter,
js::{
function::NativeFunctionData,
value::{from_value, to_value, FromValue, ResultValue, ToValue, Value, ValueData},
},
};
use gc::Gc;
use gc_derive::{Finalize, Trace};
use std::{borrow::Borrow, collections::HashMap, ops::Deref};
/// Static `prototype`, usua... |
#![no_std]
use bootloader::boot_info::{FrameBufferInfo, PixelFormat};
use conquer_once::spin::OnceCell;
use spin::Mutex;
use core::{
fmt::{self},
ptr,
};
use font8x8::UnicodeFonts;
/// The global Writer instance used for the `log` crate.
pub static WRITER: OnceCell<Mutex<Writer>> = OnceCell::uninit();
/// A ... |
fn main() {
let gamma_bits = gamma(&input());
let gamma = to_dec(&gamma_bits);
let epsilon = to_dec(&invert(&gamma_bits));
println!(
"First solution: gamma={}, epsilon={}, product={}",
gamma,
epsilon,
gamma * epsilon
);
let oxygen = to_dec(&life_support(input(), ... |
mod lib;
fn main() {
let s = "abcd";
let t = "becd";
println!("{}", lib::lcs(s, t));
}
|
use crate::Vec2;
use super::Window;
use glium::{
Display,
glutin::{
self,
dpi::PhysicalSize,
window::WindowId
}
};
static mut WINDOWS: Vec <Display> = Vec::new();
pub struct WindowBuilder {
size: Option <Vec2 <u32>>,
title: String
}
impl Default for WindowBuilder {
fn ... |
#[macro_use]
use std::ops::{ Add, RangeInclusive };
use std::any::{ TypeId, Any };
use std::rc::Rc;
use std::cell::RefCell;
use log::{ info, debug, trace };
use crate::instructions::InstrThumb16;
/*
* ARMv7-M THUMB ENCODING
*
* The Thumb instruction stream is a sequence of halfword-aligned halfwords. Each Thumb ... |
use schemars::JsonSchema;
use std::collections::HashMap;
#[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Serialize)]
#[cfg_attr(feature = "python", derive(FromPyObject, IntoPyObject))]
pub struct VideoScaling {
pub width: Option<u32>,
pub height: Option<u32>,
}
impl Into<HashMap<String, String>> for &V... |
use crate::name::{ NamePtr, NamesPtr, StringPtr };
use crate::level::LevelsPtr;
use crate::expr::ExprPtr;
use crate::tc::infer::InferFlag::*;
use crate::quot::add_quot;
use crate::inductive::IndBlock;
use crate::utils::{
Tc,
Ptr,
Env,
Live,
IsCtx,
IsLiveCtx,
LiveZst,
ListPtr,
... |
extern crate clap;
use self::clap::{App, Arg};
use config::Config;
pub fn get_opts() -> Config {
let matches = App::new("dowser - ike-scan convenience facade")
.version(env!("CARGO_PKG_VERSION"))
.author("eHealth Experts GmbH https://www.ehealthexperts.de")
... |
#![allow(unused)]
use std::process::Command;
use std::io;
#[cfg(windows)] use winres::WindowsResource;
fn main() {
#[cfg(target_os = "windows")]
fn pack_resource(){
Command::new("packfolder")
.args(&["app", "target/assets.rc", "-binary"])
.output()
.expect("Unable to run packfolder.exe!");
Wind... |
//! This crate provides generic escaping of characters without requiring allocations. It leverages
//! `fast_fmt` crate to do this.
//!
//! #Examples
//!
//! Escaping whole writer
//!
//! ```
//! #[macro_use]
//! extern crate fast_fmt;
//! extern crate fast_escape;
//! extern crate void;
//!
//! use fast_escape::Escape... |
extern crate env_logger;
extern crate clap;
#[macro_use] extern crate log;
use env_logger::{
Builder,
Env
};
use clap::{App, Arg};
use std::net::SocketAddr;
use pcap::{Device, Capture};
use pnet::packet::{
ethernet::{EtherTypes, EthernetPacket},
ipv4::Ipv4Packet,
Packet,
};
mod handlers;
fn get_req... |
#[doc = "Register `AHB1RSTR` reader"]
pub type R = crate::R<AHB1RSTR_SPEC>;
#[doc = "Register `AHB1RSTR` writer"]
pub type W = crate::W<AHB1RSTR_SPEC>;
#[doc = "Field `GPIOARST` reader - IO port A reset"]
pub type GPIOARST_R = crate::BitReader<GPIOARST_A>;
#[doc = "IO port A reset\n\nValue on reset: 0"]
#[derive(Clone,... |
use std::io::{BufRead, BufReader, Error};
use std::fs::File;
use std::iter::FromIterator;
use std::collections::VecDeque;
#[derive(Clone, Debug, Copy, Eq, PartialEq)]
enum GridEntry {
Empty,
Near(usize),
Neutral,
Infinity,
}
pub fn advent6b() -> Result<usize, Error> {
let f = File::open("input6.tx... |
extern crate cgmath;
use cgmath::Vector3;
#[derive(Copy, Clone, Debug, PartialEq)]
pub struct Ray {
pub origin: Vector3<f64>,
pub direction: Vector3<f64>,
}
impl Ray {
pub fn point(&self, t: f64) -> Vector3<f64> {
self.origin + self.direction * t
}
}
#[cfg(test)]
mod tests {
use super::*;... |
use near_contract_standards::fungible_token;
use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize};
use near_sdk::env::log;
use near_sdk::serde_json::{json, from_slice};
use near_sdk::{AccountId, Balance, PromiseOrValue, PublicKey, env, near_bindgen, setup_alloc, ext_contract, log};
use near_sdk::collections::... |
#[cfg(target_os = "linux")]
fn are_you_on_linux() {
println!("You are running linux!");
}
#[cfg(not(target_os = "linux"))]
fn are_you_on_linux() {
println!("You are *not* running linux!");
}
#[cfg(target_os = "macos")]
fn are_you_on_macos() {
println!("You are running macos!");
}
#[cfg(not(target_os = "m... |
#[cfg(test)]
mod tests {
use avi_rs::bytes::{BigEndian, LittleEndian};
#[test]
fn byteorder() {
let mut buf = [0u8;4];
let u = 43608830 as u32;
BigEndian::write_u32(u, &mut buf, 0);
let r = BigEndian::read_u32(&buf, 0);
println!("Write BigEndian: {:?}", buf);
... |
use std::fmt;
use std::fmt::{Display, Formatter};
use std::str::FromStr;
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum Instruction {
Acc(isize),
Jmp(isize),
Nop(isize),
}
impl Instruction {
pub fn exec(&self, m: &mut RegisterFile) {
match self {
Instruction::Nop(_) => m.ip ... |
//! Convert the radix (base) of digits stored in a vector.
//!
//! * pure rust, no bigint deps or intermediate conversions
//! * designed around vectors of unsigned integer types, not strings
//! * very fast on large vectors when bases are aligned
//! (see performance section below)
//!
//! # examples
//!
//! convert... |
// Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
// TODO: add diagram
#![allow(dead_code)]
pub mod buffer_manager;
pub mod commit_phase;
pub mod errors;
pub mod execution_phase;
pub mod ordering_state_computer;
pub mod pipeline_phase;
pub mod signing_phase;
#[cfg(test)]
mod tests;
|
use solana_program::{
account_info::{next_account_info, AccountInfo},
entrypoint::ProgramResult,
msg,
program::{invoke, invoke_signed},
program_error::ProgramError,
program_pack::{IsInitialized, Pack},
pubkey::Pubkey,
rent::Rent,
sysvar::Sysvar,
};
use borsh::{BorshDeserialize, Bors... |
extern crate gbl;
#[macro_use]
extern crate criterion;
use criterion::{Bencher, Benchmark, Criterion, Throughput};
use gbl::{AesKey, AppImage, Gbl, P256KeyPair};
/// Includes a binary or text file from the test data directory.
macro_rules! test_data {
( bytes $file:tt ) => {
&include_bytes!(concat!("../te... |
// Copyright 2018 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.
extern crate failure;
extern crate fidl;
extern crate fidl_fuchsia_auth;
extern crate fuchsia_app as component;
extern crate fuchsia_async as async;
extern... |
//! Types
//!
//! See: [6.7 Types](http://erlang.org/doc/apps/erts/absform.html#id88630)
use ast;
use ast::common;
use ast::literal;
pub type UnaryOp = common::UnaryOp<Type>;
pub type BinaryOp = common::BinaryOp<Type>;
#[derive(Debug, Clone)]
pub enum Type {
Atom(Box<literal::Atom>),
Integer(Box<literal::Inte... |
#![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 Resource {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(d... |
use crate::domain::role::{Role, RoleId};
use crate::domain::user::{
Email, Fullname, Identity, Password, PasswordHasher, Person, Provider, User, UserId, Username,
};
use crate::mocks::FakePasswordHasher;
pub fn user1() -> User {
let ph = FakePasswordHasher::new();
User::new(
UserId::new("#user1").u... |
use glium::glutin::event::{Event, StartCause, WindowEvent};
use glium::glutin::event_loop::{ControlFlow, EventLoop};
use glium::glutin::window::WindowBuilder;
use glium::glutin::ContextBuilder;
use lazy_static::lazy_static;
use send_wrapper::SendWrapper;
use std::cell::RefCell;
use std::collections::VecDeque;
use std::... |
use anyhow::{format_err, Error};
use derive_more::{Deref, From, Into};
use serde::{Deserialize, Serialize};
use stack_string::StackString;
use std::{
convert::{Into, TryFrom, TryInto},
fmt::Debug,
str::FromStr,
sync::Arc,
};
use url::Url;
use uuid::Uuid;
use gdrive_lib::date_time_wrapper::DateTimeWrapp... |
use crate::block_assembler::{
BlockAssembler, BlockTemplateCacheKey, CandidateUncles, TemplateCache,
};
use crate::component::commit_txs_scanner::CommitTxsScanner;
use crate::component::entry::TxEntry;
use crate::config::BlockAssemblerConfig;
use crate::error::BlockAssemblerError;
use crate::pool::TxPool;
use ckb_d... |
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
use failure::Error;
use identity::{Identity, Signature, Secret, Address};
use packet::{self, RoutingDirection, RoutingKey};
use snow::{self, params::NoiseParams, Builder};
use snow::resolvers::{FallbackResolver, CryptoResolver};
use std::io::Write;
use std::io::R... |
// SPDX-License-Identifier: Apache-2.0
use super::Vm;
use crate::backend::{Command, Thread};
use sallyport::syscall::enarx::MemInfo;
use sallyport::syscall::{SYS_ENARX_BALLOON_MEMORY, SYS_ENARX_MEM_INFO};
use sallyport::KVM_SYSCALL_TRIGGER_PORT;
use super::personality::Personality;
use anyhow::{anyhow, Result};
use... |
mod peers;
mod addrs;
mod connect;
mod disconnect;
use clap::{ App, AppSettings, SubCommand, ArgMatches };
use context::Context;
pub fn subcommand() -> App<'static, 'static> {
SubCommand::with_name("swarm")
.about("\
Manipulate the network swarm.\n\
\n\
The swarm is th... |
// This is the main file of RPFM. Here is the main loop that builds the UI and controls
// his events.
// Disable warnings about unknown lints, so we don't have the linter warnings when compiling.
#![allow(unknown_lints)]
// Disable these two clippy linters. They throw a lot of false positives, and it's a pain in the... |
use cosmwasm_std::{
from_binary, log, to_binary, Api, Binary, CanonicalAddr, Decimal, Env, Extern, HandleResponse,
HandleResult, HumanAddr, InitResponse, MigrateResponse, MigrateResult, Order, Querier,
StdError, StdResult, Storage, Uint128,
};
use crate::{
bond::bond,
compound::{compound, stake},
... |
use std::{
fmt::{Debug, Display},
str::FromStr,
};
use lazy_static::lazy_static;
use never::Never;
use regex::Regex;
use super::{Field, index::Index};
#[derive(PartialEq, Eq, Hash)]
pub enum DocumentType {
Almanaque,
Anais,
Anuario,
Artigo,
Ata,
Atlas,
Biografia,
Boletim,
... |
use std::fmt;
/// Write a hexdump of the provided byte slice.
pub fn hexdump(
f: &mut fmt::Formatter,
prefix: &str,
buffer: &[u8],
) -> std::result::Result<(), std::fmt::Error> {
const COLUMNS: usize = 16;
let mut offset: usize = 0;
if buffer.is_empty() {
// For a zero-length buffer, a... |
#![cfg_attr(
any(feature = "print_attributes", feature = "hacspec_unsafe"),
feature(proc_macro_diagnostic)
)]
#![cfg_attr(
any(feature = "print_attributes", feature = "hacspec_unsafe"),
feature(proc_macro_span)
)]
extern crate ansi_term;
extern crate hacspec_util;
extern crate quote;
extern crate serde... |
use std::fs::File;
use std::mem::size_of;
use std::time::Instant;
use std::{cmp, io};
use log::debug;
use memmap::Mmap;
use crate::INITIAL_SORTER_VEC_SIZE;
use crate::{DEFAULT_COMPRESSION_LEVEL, DEFAULT_SORTER_MEMORY, MIN_SORTER_MEMORY};
use crate::{DEFAULT_NB_CHUNKS, MIN_NB_CHUNKS};
use crate::{Merger, MergerIter};
... |
#[get("/params/<id>")]
pub fn params(id: Option<usize>) -> String {
match id {
Some(n) => format!("usize: {}", n),
None => "Not a usize".to_string(),
}
}
|
use crossbeam_utils::thread;
use itertools::Itertools;
use std::{
io::{Read, Write},
net::TcpListener,
path::Path,
process::{Command, Stdio},
sync::mpsc,
};
type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
fn main() -> Result<()> {
let listener = TcpListener::bind("0.0.0.0:... |
mod parse;
use parse::parser::*;
use serde_json;
use std::io::{self, Read};
fn main() -> io::Result<()> {
let mut buffer = String::new();
io::stdin().read_to_string(&mut buffer)?;
let page = parse::page::ParlerPage::from_html(&buffer).unwrap();
//println!("{:#?}", page);
serde_json::to_writer_prett... |
use bitflags::bitflags;
use serde::{Deserialize, Serialize};
use std::borrow::Cow;
pub mod gateway;
pub const BASE_URL: &'static str = "https://discordapp.com/api";
#[derive(Deserialize)]
#[serde(deny_unknown_fields)]
pub struct GatewayResponse {
pub url: String,
}
#[derive(Clone, Debug, Serialize, Deserialize)... |
use apllodb_immutable_schema_engine_domain::abstract_types::ImmutableSchemaAbstractTypes;
use super::{
sqlite_rowid::SqliteRowid,
transaction::sqlite_tx::{
version::repository_impl::VersionRepositoryImpl,
version_revision_resolver::VersionRevisionResolverImpl,
vtable::repository_impl::V... |
use std::io::{self};
fn main() {
let mut a = String::new();
io::stdin().read_line(&mut a).unwrap();
let mut bc = String::new();
io::stdin().read_line(&mut bc).unwrap();
let bcvec: Vec<&str> = bc.trim_end_matches('\n').split(" ").collect();
let sum = a.trim_end_matches('\n').parse::<i32>().unwrap() + bcvec[... |
use glium::{Frame, Surface};
use crate::math::{normalize_vector, cross_product};
#[derive(Copy, Clone)]
pub struct Camera {
pub position: [f32; 3],
pub height: f32,
pub direction: [f32; 3],
pub pitch_yaw: (f32, f32)
}
pub const UP: [f32; 3] = [0.0, 1.0, 0.0];
impl Camera {
pub fn new(position: [f32; 3], height... |
extern crate rustc_serialize;
extern crate pcap;
use rustc_serialize::Encodable;
#[derive(RustcDecodable, RustcEncodable)]
pub struct PacketContainer<T: Encodable> {
pub host_identifier: String,
pub data: Vec<T>,
}
#[derive(RustcDecodable, RustcEncodable)]
pub struct PingPacket {
pub timestamp: i64,
... |
use bitwise::bitwiseops;
pub trait BlockCipher {
fn process_block(&self, input: &[u8]) -> Vec<u8>;
}
pub struct SingleCharXorCipher {
key: u8,
}
impl SingleCharXorCipher {
pub fn new(key: u8) -> SingleCharXorCipher {
SingleCharXorCipher {
key: key,
}
}
}
pub struct XorCip... |
use std::sync::mpsc::channel;
use std::sync::mpsc::Sender;
use std::sync::Arc;
use std::sync::Mutex;
use std::thread;
type Thunk<'a> = Box<dyn FnOnce() + Send + 'a>;
pub struct ThreadPool {
job_sender: Sender<Thunk<'static>>,
}
impl ThreadPool {
pub fn new(capacity: usize) -> Self {
let (tx, rx) = ch... |
use std::collections::HashMap;
use apllodb_shared_components::{ApllodbError, ApllodbResult, SessionId};
use generational_arena::{Arena, Index};
use crate::sqlite::database::SqliteDatabase;
#[derive(Debug, Default)]
pub(crate) struct SqliteDatabasePool {
pub(crate) db_arena: Arena<SqliteDatabase>,
pub(crate) ... |
#![no_std]
use zoon::*;
blocks!{
#[derive(Copy, Clone)]
enum Color {
Red,
Blue,
}
#[s_var]
fn color() -> Color {
Color::A
}
#[update]
fn toggle_color() {
use Color::{Red, Blue};
color().update(|color| if let Red = color { Blue } else { Red });... |
use super::super::{components, input, resources};
use specs::{Read, ReadStorage, System, WriteStorage};
pub struct PlayerInput;
impl<'a> System<'a> for PlayerInput {
type SystemData = (
ReadStorage<'a, components::Player>,
ReadStorage<'a, components::Position>,
WriteStorage<'a, components:... |
use super::*;
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
#[repr(transparent)]
pub struct ObjAttr2(u16);
impl ObjAttr2 {
const_new!();
bitfield_int!(u16; 0..=9: u16, tile_index, with_tile_index, set_tile_index);
bitfield_int!(u16; 10..=11: u16, priority, with_priority, set_priority);
bitfield_int!(u1... |
use crate::days::day16::{parse_input, TicketInput};
use crate::days::day16::default_input;
use std::collections::HashMap;
pub fn run() {
println!("{}", tickets_str(default_input()).unwrap());
}
pub fn tickets_str(input: &str) -> Result<i64, ()> {
tickets(parse_input(input))
}
pub fn tickets(input: TicketInpu... |
use std::collections::HashSet;
use proc_macro2::{TokenStream as Tokens, Span};
use syn::{Data, DeriveInput, Fields, DataEnum, Ident};
use quote::quote;
pub fn derive(input: &DeriveInput) -> Tokens {
let name = &input.ident;
let generics = super::add_trait_bounds(
input.generics.clone(),
&HashS... |
use std::fmt;
use auto_impl::auto_impl;
#[auto_impl(&)]
trait Trait {
fn foo(&self)
where Self: Clone;
fn bar(&self)
where Self: Default + fmt::Display;
}
#[derive(Clone, Default)]
struct Foo {}
impl Trait for Foo {
fn foo(&self)
where Self: Clone,
{}
fn bar(&self)
... |
#[doc = "Register `ISR` reader"]
pub type R = crate::R<ISR_SPEC>;
#[doc = "Register `ISR` writer"]
pub type W = crate::W<ISR_SPEC>;
#[doc = "Field `ADRDY` reader - ADC ready flag"]
pub type ADRDY_R = crate::BitReader<ADRDYR_A>;
#[doc = "ADC ready flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
... |
// Copyright 2019, 2020 Wingchain
//
// 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... |
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*/
#![warn(missing_debug_implementations, missing_docs)]
//! Vertex and its Adjacency List
use crate::model::GRAPH_SLACK_FACTOR;
use super::AdjacencyList;
/// The out neighbors of vertex_id
#[derive(Debug)]
pub struc... |
//! Types for the `open.189.cn` API responses.
/// An access token for the `open.189.cn` API.
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub struct AccessToken {
/// Nonce for distinguishing between access token requests.
pub state: String,
/// The access token returned.
pub token: String,
/// TT... |
//! This module contains a configuration of a Border to set its color via [`BorderColor`].
use crate::{
grid::{
color::AnsiColor,
config::{Border, ColoredConfig, Entity},
records::{ExactRecords, Records},
},
settings::{color::Color, CellOption, TableOption},
};
/// BorderColored re... |
use duct::cmd;
pub fn update_toolkit() {
let output1 = cmd!("curl", "-l", "https://raw.githubusercontent.com/WesBosch/brunch-toolkit/main/brunch-toolkit","-o","/tmp/brunch-toolkit").read().unwrap();
println!("{}", output1);
let output2 = cmd!("install", "-Dt","/usr/local/bin","-m","755","/tmp/brunch-toolki... |
mod token;
pub use self::token::{Token, TokenType};
use std::str;
use std::option::Option;
pub struct Interpreter<'a> {
pos: usize,
body: String,
current_char: Option<char>,
current_token: Token,
chars: str::Chars<'a>,
}
impl<'a> Interpreter<'a> {
pub fn new(body: &'a String) -> Interpreter<'... |
#![no_main]
#![no_std]
extern crate cortex_m_rt;
#[cfg(target_env = "")] // appease clippy
#[panic_handler]
fn panic(info: &core::panic::PanicInfo) -> ! {
cortex_m::interrupt::disable();
minitest::log!("{}", info);
minitest::fail()
}
#[minitest::tests]
mod tests {
use minitest::log;
#[init]
... |
use super::operators::Operator;
use super::types::Type;
use super::Location;
/*
program -> block*
block -> func
func -> type-id `(` param-seq `)` comp-stmt
param-seq -> type-id (`,` type-id)* | epsilon
comp-stmt -> `{` stmt* `}`
type-id -> type identifier
type -> primitive
... |
use serde_json::json;
use yew::prelude::*;
use crate::components::loading_spinner::LoadingSpinner;
#[derive(Clone, Debug, PartialEq, Properties)]
pub struct Props {
pub request_joining_lobby: bool,
pub request_creating_lobby: bool,
}
pub struct OutOfLobby {
link: ComponentLink<Self>,
props: Props,
... |
use std::{io::{self, Write}};
use serde::Serialize;
use crate::{client::tui::Tui, common::{debug_message::DebugMessageType, encryption::NetworkedPublicKey, message_type::MsgType}};
use super::ConnectionManager;
impl ConnectionManager {
pub fn send_tcp_message<T: ?Sized>(&mut self, t:MsgType, msg: &T) -> io::Res... |
extern crate euclid;
extern crate rustybuzz;
extern crate webrender;
extern crate webrender_api;
// use font_kit::font;
use std::str::FromStr;
use crate::fragment::{Point, Rect, Size, TextFragment};
use crate::glyph::{GlyphData, GlyphStore};
mod fragment;
mod glyph;
pub fn layout_text(width: i32, text: String) -> Ve... |
use crate::single_disk_farm::piece_reader::PieceReader;
use crate::utils::archival_storage_pieces::ArchivalStoragePieces;
use std::collections::hash_map::Entry;
use std::collections::HashMap;
use std::future::Future;
use subspace_core_primitives::{Piece, PieceIndex, PieceOffset, SectorIndex};
use subspace_farmer_compon... |
use super::super::alu::{internal_multiply_cycles, set_nz_flags, set_nz_flags64};
use super::super::{Cpu, Cycles, Memory};
use util::bits::Bits as _;
#[inline]
fn get_mulinstr_regs(instr: u32) -> (u32, u32, u32, u32) {
let rm = instr.bits(0, 3);
let rs = instr.bits(8, 11);
let rn = instr.bits(12, 15);
l... |
use std::rc::Rc;
use std::cell::RefCell;
use std::path::{Path, PathBuf};
use std::fs::*;
use std::io::{Read, Write, Error as IoError, ErrorKind};
use std::error::Error;
use runic::*;
use res::Resources;
use movement::*;
use app::State;
use lsp::LanguageServer;
use toml;
#[derive(Debug)]
pub enum TabStyle {
Tab,
... |
use clap::{crate_version, App, Arg, ArgMatches};
use dnsbl::{CheckResult, DNSBL};
use log::{debug, info, warn};
use serde_derive::Deserialize;
use std::collections::{HashMap, HashSet};
use std::io::Write;
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use trust_dns::client::SyncClient;
use trust_dns::udp::UdpClientConne... |
use std::collections::HashMap;
use std::time::Instant;
use crate::utils::file2vec;
pub fn day1(filename: &String)->(){
let mut contents:Vec<i32> = file2vec::<i32>(filename)
.iter().map(|x|x.to_owned().unwrap()).collect();
let mut map: HashMap<i32,usize> = HashMap::new();
for i in 0..contents.... |
#[doc = "Register `CR` reader"]
pub type R = crate::R<CR_SPEC>;
#[doc = "Register `CR` writer"]
pub type W = crate::W<CR_SPEC>;
#[doc = "Field `ALGODIR` reader - Algorithm direction"]
pub type ALGODIR_R = crate::BitReader;
#[doc = "Field `ALGODIR` writer - Algorithm direction"]
pub type ALGODIR_W<'a, REG, const O: u8> ... |
extern crate theca;
use theca::{Profile, BoolFlags};
use theca::item::Status;
#[test]
fn test_add_note() {
let mut p = Profile {
encrypted: false,
notes: vec![],
};
assert!(p.add_note("this is a title",
&[],
Some(Status::Blank),
... |
use super::io::read_until_separator;
use httparse::Status;
use std::net::SocketAddr;
use std::pin::Pin;
use std::task::{Context, Poll};
use tokio::io::{AsyncRead, AsyncWrite, AsyncWriteExt};
use tokio::net::TcpStream;
use url::Url;
#[cfg(not(any(target_os = "android", target_os = "linux")))]
pub fn get_origin_dst(_s... |
#![feature(specialization)]
#[macro_use]
extern crate log;
extern crate exact_size_iterator_traits as iter_exact;
extern crate unreachable;
extern crate void;
#[macro_use]
pub mod typehack;
#[macro_use]
pub mod array;
#[macro_use]
pub mod linalg;
#[macro_use]
pub mod geometry;
pub mod num;
|
use std::collections::BinaryHeap;
pub mod event;
pub mod line_segment;
use line_segment::LineSegment;
use line_segment::Point;
// Intersection: two lines and the point they overlap
struct Intersection {
lines: [LineSegment; 2],
overlap: Point,
}
fn find_all_intersections(mut lines: BinaryHeap<LineSegment>) ... |
use std::fs;
fn main() {
let input = fs::read_to_string("src/02/input.txt").expect("error reading input");
println!("part 1: {}", intcode(&input, (12, 2))); // 2692315
let mut params: (usize, usize) = (0, 0);
loop {
if intcode(&input, params) == 19690720 {
break;
}
... |
use std::{
convert::{TryFrom, TryInto},
fmt::Debug,
ops::{Deref, DerefMut},
};
use uuid::Uuid;
use crate::{
artist::{Artists, ArtistsWithRole},
audio::file::AudioFiles,
availability::Availabilities,
content_rating::ContentRatings,
external_id::ExternalIds,
restriction::Restrictions... |
use ast;
use name::*;
use span::{Span, IntoSpan};
use middle::*;
use lang_items::*;
use collect_types::collect_types;
use collect_members::collect_members;
use tycheck::{populate_method, populate_constructor, populate_field};
use arena::Arena;
use rbtree::RbMap;
use std::fmt;
use std::borrow::ToOwned;
use std::colle... |
pub struct ConfigService {}
impl ConfigService {
pub fn create(&self) {}
}
|
/// Defines whether a term in a query must be present,
/// should be present or must not be present.
#[derive(Debug, Clone, Hash, Copy, Eq, PartialEq)]
pub enum Occur {
/// For a given document to be considered for scoring,
/// at least one of the document with the Should or the Must
/// Occur constraint mu... |
#[doc = "Register `BDCR` reader"]
pub type R = crate::R<BDCR_SPEC>;
#[doc = "Register `BDCR` writer"]
pub type W = crate::W<BDCR_SPEC>;
#[doc = "Field `BREN` reader - Backup RAM retention in Standby and V<sub>BAT</sub> modes When this bit set, the backup regulator (used to maintain the backup RAM content in Stand... |
#[doc = "Reader of register PIDR4"]
pub type R = crate::R<u32, super::PIDR4>;
#[doc = "Reader of field `PIDR4`"]
pub type PIDR4_R = crate::R<u32, u32>;
impl R {
#[doc = "Bits 0:31 - peripheral ID4"]
#[inline(always)]
pub fn pidr4(&self) -> PIDR4_R {
PIDR4_R::new((self.bits & 0xffff_ffff) as u32)
... |
use std::sync::Arc;
use std::sync::atomic::AtomicUsize;
use std::sync::atomic::Ordering;
use std::thread::current;
use crate::mechatronics::bucket_ladder::state::GlobalIntakeState;
use crate::mechatronics::bucket_ladder::state::IntakeStateInstance;
use crate::mechatronics::drive_train::state::DriveTrainStateInstance;
... |
use futures::{Future, Stream};
use h2::server;
use http::{Response, StatusCode};
use tokio::net::TcpListener;
pub fn main() {
let addr = "127.0.0.1:5928".parse().unwrap();
let listener = TcpListener::bind(&addr).unwrap();
// Accept all incoming TCP connections.
let connection = listener
.incom... |
//! # Node
//!
//! A Tendermock `Node` encapsulates a storage and a chain.
//! A `SharedNode` is a thread-safe version of a node, for use by the various RPC interfaces.
//!
//! To integrate with IBC modules, the node implements the `Ics26Context` traits, which mainly deal
//! with storing and reading values from the st... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.