text stringlengths 8 4.13M |
|---|
//! Simple library that can be used to represent a grow-able bit array.
//!
//! Functionality includes `FIFO`, concatenation and setting bits `ON` and `OFF`.
//!
//! # Usage
//!
//! This crate is not published on `crates.io` and can be used by adding `bit_array_list` under the
//! `dependencies` section name in your pr... |
pub mod week1;
pub mod week2;
pub mod week3;
pub mod week4;
|
use crate::extensions::context::ClientContextExt;
use crate::services::database::guild::Query;
use anyhow::Result;
use crate::extensions::ChannelExt;
use crate::models::apod::Apod;
use crate::services::database::apod::DBApod;
use serenity::prelude::Context;
use std::error::Error;
use std::sync::Arc;
pub async fn che... |
#![allow(dead_code)]
use core::fmt::Display;
use core::fmt::Formatter;
use failure::Error;
use futures::IntoFuture;
use futures::{Future, Stream};
use futures_locks::Mutex as FuturesMutex;
use std::sync::Arc;
type AsyncWorkIO<T> = Box<dyn Future<Item = T, Error = Error> + Send>;
struct InternalWorkIO(pub String);
st... |
use image::DynamicImage;
use std::env;
use std::fs::File;
use std::io::Read;
use std::path::Path;
use std::vec::Vec;
use vtf::Error;
fn main() -> Result<(), Error> {
let args: Vec<_> = env::args().collect();
if args.len() != 3 {
panic!("Usage: png <path to vtf file> <destination of new png file>");
... |
// auto generated, do not modify.
// created: Mon Feb 22 23:57:02 2016
// src-file: /QtCore/qstring.h
// dst-file: /src/core/qstring.rs
//
// header block begin =>
#![feature(libc)]
#![feature(core)]
#![feature(collections)]
extern crate libc;
use self::libc::*;
// <= header block end
// main block begin =>
// <= m... |
pub fn demo() {
let v: Vec<i32> = Vec::new();
println!(v);
} |
windows::core::include_bindings!();
use crate::Windows::Win32::Globalization::{SetThreadPreferredUILanguages, MUI_LANGUAGE_NAME};
pub fn set_thread_ui_language(language_tag: &str) -> bool {
unsafe {
let mut _languages_set = 0;
SetThreadPreferredUILanguages(MUI_LANGUAGE_NAME, format!("{}\0\0", lang... |
#[doc = "Reader of register OTG_FS_GADPCTL"]
pub type R = crate::R<u32, super::OTG_FS_GADPCTL>;
#[doc = "Writer for register OTG_FS_GADPCTL"]
pub type W = crate::W<u32, super::OTG_FS_GADPCTL>;
#[doc = "Register OTG_FS_GADPCTL `reset()`'s with value 0x0200_0400"]
impl crate::ResetValue for super::OTG_FS_GADPCTL {
ty... |
#[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::MIS {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w ... |
use std::collections::HashMap;
use std::hash::{Hash, Hasher};
use std::cell::RefCell;
use std::rc::{Rc, Weak};
use std::fmt;
struct Node {
v: i32,
p: Option<Weak<RefCell<Node>>>,
}
fn main() {
let mut arr: Vec<Rc<RefCell<Node>>> = Vec::new();
arr.push(Rc::new(RefCell::new(Node {v: 0, p: None})));
... |
use petgraph::{Graph, Directed};
use petgraph::graph::NodeIndex;
use super::super::graph::{Node, Edge};
fn segment(
graph: &Graph<Node, Edge, Directed>,
h1: &Vec<NodeIndex>,
) -> (Vec<(NodeIndex, NodeIndex)>, Vec<(NodeIndex, NodeIndex)>) {
let mut inner = vec![];
let mut outer = vec![];
for u in h1... |
use gl::types::*;
use super::{Primitive, Buffer, BufferData, BufferAcces, BufferType, Format};
use crate::get_value;
use anyhow::{Result, bail};
use std::collections::HashMap;
type AttributePoint = (GLuint, GLint, GLenum, GLboolean, GLsizei, GLuint);
pub struct Vao {
id: GLuint,
format: Format,
bindings... |
// 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.
use argh::FromArgs;
use failure::{Error, ResultExt};
use fidl_fidl_examples_echo::EchoServiceMarker;
use fuchsia_async as fasync;
use fuchsia_component::cl... |
fn main() {
let array: [u8; config::DIMENSION] = [config::NUMBER; config::DIMENSION];
println!("{:#?}", array);
}
|
use clap::ArgMatches;
use solana_clap_utils::{input_parsers::pubkey_of_signer, keypair::pubkey_from_path};
use solana_cli_output::OutputFormat;
use solana_client::rpc_client::RpcClient;
use solana_remote_wallet::remote_wallet::RemoteWalletManager;
use solana_sdk::pubkey::Pubkey;
use std::{process::exit, sync::Arc};
pu... |
// auto generated, do not modify.
// created: Mon Feb 22 23:57:02 2016
// src-file: /QtWidgets/qtoolbox.h
// dst-file: /src/widgets/qtoolbox.rs
//
// header block begin =>
#![feature(libc)]
#![feature(core)]
#![feature(collections)]
extern crate libc;
use self::libc::*;
// <= header block end
// main block begin =>... |
use openidconnect::{core, EndUserName, EndUserUsername, LocalizedClaim};
use rocket::{
http::{Cookie, Status},
request::{self, FromRequest, Outcome, Request},
State,
};
use crate::{
application::{OidcApplication, OidcSessionCookie},
errors::IdTokenError,
};
/// Rocket request guard for OpenID Conn... |
// Definition for singly-linked list.
#[derive(PartialEq, Eq, Clone, Debug)]
pub struct ListNode {
pub val: i32,
pub next: Option<Box<ListNode>>
}
impl ListNode {
#[inline]
fn new(val: i32) -> Self {
ListNode {
next: None,
val
}
}
fn from_vec(v: Vec<i32>... |
use std::clone::Clone;
use super::wrapping_number::{sequence_greater_than, sequence_less_than};
/// Used to index packets that have been sent & received
pub type SequenceNumber = u16;
/// Collection to store data of any kind.
#[derive(Debug)]
pub struct SequenceBuffer<T: Clone> {
sequence_num: SequenceNumber,
... |
use crate::prelude::*;
pub type LineSegment = [Point2; 2];
pub trait LineSegmentExtension {
fn length2(&self) -> f32;
fn interpolate(&self, progress: NormalizedF32) -> Point2;
}
impl LineSegmentExtension for LineSegment {
fn length2(&self) -> f32 {
self[0].distance2(self[1])
}
fn interpol... |
pub mod ast;
pub mod error;
pub mod lexer;
pub mod parser;
pub mod precedence;
pub mod token;
pub mod token_type;
|
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// !!!!!!!!!!! very unstable, use at your own risk !!!!!!!!!!!!!!!!!
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!... |
use om_sd::na;
use na::{Vector2, Vector3};
use std::fs::File;
use std::io::Write;
fn steepest_descent_with_both() {
let f = |x: Vector2<f64>| x[0].powi(2) + x.norm_squared().exp() + 4.0 * x[0] + 3.0 * x[1];
let grad = |x: Vector2<f64>| Vector2::new(
2.0 * x[0] * (1.0 + x.norm_squared().exp()) + 4.0,... |
// Copyright 2021 Datafuse Labs.
//
// 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 ... |
/*
Project Euler Problem 18:
By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23.
3
7 4
2 4 6
8 5 9 3
That is, 3 + 7 + 4 + 9 = 23.
Find the maximum total from top to bottom of the triangle below:
75
95 64
17 47 82
18 35 87 10
20 0... |
use timely::dataflow::operators::UnorderedInput;
use timely::progress::frontier::AntichainRef;
use differential_dataflow::trace::TraceReader;
use declarative_dataflow::domain::{AsSingletonDomain, Domain};
use declarative_dataflow::{Aid, Value};
#[test]
fn test_advance_epoch() {
let mut domain = Domain::<Aid, u64... |
pub struct CncError {
message: String,
}
impl std::fmt::Display for CncError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", self.message)
}
}
impl std::fmt::Debug for CncError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", self.message)
... |
#![no_std]
#![feature(test)]
extern crate aesni;
extern crate test;
#[bench]
pub fn aes128_encrypt(bh: &mut test::Bencher) {
let cipher = aesni::Aes128::init(&Default::default());
let mut input = Default::default();
bh.iter(|| {
cipher.encrypt(&mut input);
test::black_box(&input);
});
... |
// Copyright © 2017-2023 Trust Wallet.
//
// This file is part of Trust. The full Trust copyright notice, including
// terms governing use, modification, and redistribution, is contained in the
// file LICENSE at the root of the source code distribution tree.
use std::collections::HashMap;
const ALPHABET_RFC4648: &[u... |
use test_winrt_composable::*;
use windows::core::*;
use Component::Composable::*;
#[test]
fn base() -> Result<()> {
let base = Base::new()?;
assert!(base.Value()? == 0);
base.SetValue(123)?;
assert!(base.Value()? == 123);
let base = Base::CreateWithValue(456)?;
assert!(base.Value()? == 456);
... |
/*
Copyright 2020 Timo Saarinen
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 writing, software
d... |
// Copyright 2017 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 ... |
mod accounting {
use regex::Regex;
use std::fs::File;
use std::io::BufRead;
use std::path::Path;
#[derive(Debug)]
pub struct Puzzle<T, U>
where
U: Fn(String) -> Option<T>,
{
xform: U,
day: u32,
}
impl<T, U> Puzzle<T, U>
where
U: Fn(String) ->... |
use super::Castable;
use super::{super::ray::Ray, CastInfo};
use crate::shapes::Shape;
use crate::{
material::{Material, MaterialType},
shapes::Movable,
};
use na::{Isometry3, Point3, Unit, Vector3};
#[derive(Debug, Copy, Clone)]
pub struct Plane {
normal: Unit<Vector3<f32>>,
center: Point3<f32>,
size: (Opti... |
use crate::errors::AndroidError;
use std::process::Command;
use log::debug;
const ANDROID_TARGETS: &'static [&str] = &[
"aarch64-linux-android",
"armv7-linux-androideabi",
"i686-linux-android",
];
/// Checks to see if rustup is installed
pub fn check_rustup() -> Result<(), AndroidError> {
debug!("Che... |
#[path = "with_reference/with_flush_and_info_options.rs"]
mod with_flush_and_info_options;
#[path = "with_reference/with_flush_option.rs"]
mod with_flush_option;
#[path = "with_reference/with_info_option.rs"]
mod with_info_option;
#[path = "with_reference/without_options.rs"]
mod without_options;
test_stdout!(without_... |
use std::{fmt, str};
use crate::*;
/// Contains Lux Ai API commands definitions
pub struct Commands {}
impl Commands {
/// Input city
pub const CITY: &'static str = "c";
/// Input city tile
pub const CITY_TILES: &'static str = "ct";
/// Input done
pub const DONE: &'static str = "D_DONE";
... |
use std::fmt;
use std::convert::From;
use std::io;
#[derive(Debug)]
pub struct StatsError (String);
impl fmt::Display for StatsError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.0)
}
}
impl From<io::Error> for StatsError {
fn from(io_err: io::Error) -> Self {... |
/*
* CS 538, Spring 2019: HW4
* Problem 1 : COMPLETE
*
* Write implementations of the following simple functions. You can use basic Vector operations
* like `push`, `pop`, and `contains`, but do not use the built-in `dedup` or `filter` functions,
* for instance.
*
* Take a look at the Vector documentation for a... |
use super::*;
pub fn gen_sys_file(root: &'static str, tree: &TypeTree, ignore_windows_features: bool) -> TokenStream {
let gen = Gen { relative: tree.namespace, root, ignore_windows_features, docs: false, build: false };
let types = gen_sys(tree, &gen);
let namespaces = tree.namespaces.iter().filter_map(m... |
use estrelas_math::vector2::Vector2;
#[derive(Default, PartialEq, Clone, Copy)]
pub struct Transform2D {
pub position: Vector2,
pub rotation: Vector2,
pub scale: Vector2
}
impl Transform2D {
pub fn new(position: Vector2, rotation: Vector2, scale: Vector2) -> Self {
Transform2D {
po... |
use std::sync::{
atomic::{AtomicUsize, Ordering},
Arc,
};
use actix::prelude::*;
use tokio::sync::oneshot;
#[derive(Debug)]
struct Ping(usize);
impl Message for Ping {
type Result = ();
}
struct MyActor(Arc<AtomicUsize>);
impl Actor for MyActor {
type Context = Context<Self>;
}
impl Handler<Ping> ... |
use crate::actions::MatchAction;
use crate::contact::Contact;
use anyhow::{bail, Result};
pub struct Mutt {}
impl Mutt {
pub fn new() -> Self {
Mutt {}
}
}
impl MatchAction for Mutt {
fn process(&self, contacts: Vec<&mut Contact>) -> Result<bool> {
if contacts.is_empty() {
bai... |
use std::fs;
use std::fs::File;
use std::io::prelude::*;
use std::path::Path;
use serde::{Deserialize, Serialize};
use serde_json::json;
use glob::Pattern;
#[derive(Serialize, Deserialize)]
#[derive(Debug)]
pub struct Settings {
pub(crate) api_url: String,
pub(crate) directory: String,
pub(crate) follow_l... |
use irc::proto::Command;
pub fn hl_sx(s: &str, at: usize) -> String {
if s.is_empty() {
return String::new();
}
if s.len() == 1 {
return format!("{{mod=invert {}}}", s);
}
let (l, r) = s.split_at(at);
let mut n = String::with_capacity(s.len() + "{mod=invert X}".len());
n.p... |
use std::fmt;
use std::error::Error;
#[derive(Debug, Clone)]
pub enum AssemblerError {
NoSegmentDeclarationFound{ instruction: u32 },
StringConstantDeclaredWithoutLabel{ instruction: u32 },
SymbolAlreadyDeclared,
UnknownDirectiveFound{ directive: String },
NonOpcodeInOpcodeField,
InsufficientSe... |
// Copyright 2023 Datafuse Labs.
//
// 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 ... |
use concept_learning::algo::*;
use concept_learning::parser;
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
let input = "/home/deep/work/rust/concept_learning/data/input.csv";
let data = parser::parse(input)?;
let hypothesis = find_s(data);
println!("FIND-S algorithm says: {}", hypothesis);
... |
use std::io::{Read, Result as IOResult};
use crate::PrimitiveRead;
pub struct ModelLODHeader {
pub meshes_count: i32,
pub mesh_offset: i32,
pub switch_point: f32
}
impl ModelLODHeader {
pub fn read(read: &mut dyn Read) -> IOResult<Self> {
let meshes_count = read.read_i32()?;
let meshes_offset = read... |
use super::day::{Day};
pub struct Day08 {}
impl Day08 {
fn parse_input(input: &str) -> Vec<Vec<String>> {
input.lines()
.map(|line| line
.split(" | ")
.nth(1)
.unwrap()
.split(' ')
.map(String::from)
... |
//! Contains integration tests for Telamon.
use telamon::device::{fake, Context};
use telamon::explorer;
use telamon::helper;
use telamon::ir::{self, Size, Type};
use telamon::search_space::*;
/// Find the best candidate for a function and outputs it.
pub fn gen_best(context: &dyn Context, space: SearchSpace) {
l... |
use fuzzcheck::DefaultMutator;
#[derive(Clone, DefaultMutator)]
pub struct X;
#[derive(Clone, DefaultMutator)]
pub struct Y {}
#[derive(Clone, DefaultMutator)]
pub struct Z();
|
use itertools::Itertools;
use multimap::MultiMap;
use regex::{Captures, Regex};
use std::fmt;
use lazy_static::lazy_static; // 1.3.0
type BagSpec<'a> = (&'a str, &'a str);
type Rules<'a> = MultiMap<BagSpec<'a>, (usize, BagSpec<'a>)>;
lazy_static! {
static ref shiny_gold: Regex = Regex::new(r"(?m)(\w+\s\w+)\sbags\... |
use std::fs;
use std::path::PathBuf;
use anyhow::anyhow;
use anyhow::Context as _;
use anyhow::Result;
use async_std::task;
use clap::Clap;
fn main() -> Result<()> {
pretty_env_logger::init();
task::block_on(run())
}
#[derive(Clap)]
enum EncDec {
Encrypt,
Decryp,
}
#[derive(Clap)]
#[clap(author, abo... |
//! gRPC service implementations for `ingester`.
mod persist;
mod query;
mod rpc_write;
use std::{fmt::Debug, sync::Arc};
use iox_catalog::interface::Catalog;
use service_grpc_catalog::CatalogService;
use crate::{
dml_sink::DmlSink,
ingest_state::IngestState,
ingester_id::IngesterId,
init::IngesterR... |
use actix_web::{FromRequest, HttpResponse, HttpRequest, dev};
use crate::utils::jwt::decode_token;
use crate::models::user::SlimUser;
use actix_web_httpauth::extractors::bearer::BearerAuth;
pub type LoggedUser = SlimUser;
impl FromRequest for LoggedUser {
type Error = HttpResponse;
type Future = Result<Self, ... |
use rskafka_wire_format::{error::ParseError, prelude::*};
use std::borrow::Cow;
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
pub enum ErrorCode {
UnknownServerError,
None,
OffsetOutOfRange,
CorruptMessage,
UnknownTopicOrPartition,
InvalidFetchSize,
LeaderNotAvailable,
NotLeaderFor... |
extern crate libloading as dlib;
use std::env;
use std::io::prelude::*;
fn get_puzzle_string(input_string: &str) -> String {
// Try reading as a file. If it fails then assume argument is the input string as is.
match std::fs::File::open(input_string) {
Ok(mut f) => {
let mut puzzle_string... |
#[allow(unused_imports)]
use proconio::{marker::*, *};
#[allow(unused_imports)]
use std::{cmp::Ordering, convert::TryInto};
const W: usize = 1500;
const H: usize = 1500;
#[fastout]
fn main() {
input! {
n: i32,
range: [((usize, usize), (usize, usize)); n],
}
// x[y][x] = (y, x) の右/上との差分
... |
use super::{log, log1p, sqrt};
const LN2: f64 = 0.693147180559945309417232121458176568; /* 0x3fe62e42, 0xfefa39ef*/
/// Inverse hyperbolic cosine (f64)
///
/// Calculates the inverse hyperbolic cosine of `x`.
/// Is defined as `log(x + sqrt(x*x-1))`.
/// `x` must be a number greater than or equal to 1.
#[cfg_attr(al... |
#![deny(missing_docs, missing_debug_implementations, missing_copy_implementations, trivial_casts,
trivial_numeric_casts, unsafe_code, unstable_features, unused_import_braces,
unused_qualifications)]
// `error_chain!` can recurse deeply
#![recursion_limit = "1024"]
//! Tools for interacting with LabVIEW ... |
use crate::feature;
use crate::runtime::{MachineTrap, Runtime, SupervisorContext};
use core::{
ops::{Generator, GeneratorState},
pin::Pin,
};
use riscv::register::{mie, mip};
pub fn execute_supervisor(supervisor_mepc: usize, a0: usize, a1: usize) -> ! {
let mut rt = Runtime::new_sbi_supervisor(supervisor_m... |
pub struct Scalar {
value: f64,
speed: f64,
state: ScalarState,
}
#[derive(Clone, Copy, Eq, PartialEq)]
pub enum ScalarState {
Constant,
Increasing,
Decreasing,
}
impl Scalar {
pub fn new(value: f64, speed: f64) -> Scalar {
Scalar {
value,
speed,
... |
/*
*/
use crate::core::depsgraph::{
slot::Slot,
trait_node::{Node, SlotTypes},
};
use crate::core::{
context::{ptype::PType, Context},
utils::typedefs::Key,
};
use std::{
collections::{BTreeMap, BTreeSet},
sync::Arc,
};
use super::interface::Interface;
/*
Please keep in mind, this graph ... |
use crate::auth;
use crate::handlers::types::*;
use crate::Pool;
use actix_web::{web, Error, HttpResponse};
use actix_web_httpauth::extractors::bearer::BearerAuth;
use crate::controllers::chat_thread_controller::*;
use crate::diesel::QueryDsl;
use crate::diesel::RunQueryDsl;
use crate::helpers::socket::push_thread_me... |
use super::*;
use std::ops::Range;
fn batch_command(texture: Option<&Texture>, vertex_range: Range<usize>) -> BatchCommand {
BatchCommand {
texture: texture.cloned(),
vertex_range,
}
}
#[derive(Debug, Clone)]
pub struct BatchCommand {
pub texture: Option<Texture>,
pub vertex_range: Ran... |
//! File system with inode support + read and write operations on inodes
//!
//! Create a filesystem that has a notion of inodes and blocks, by implementing the [`FileSysSupport`], the [`BlockSupport`] and the [`InodeSupport`] traits together (again, all earlier traits are supertraits of the later ones).
//! Additional... |
mod input_stream;
mod state_stream;
mod input_stream_source;
mod input_stream_core;
pub use self::state_stream::*;
pub use self::input_stream::*;
pub use self::input_stream_source::*;
|
use super::*;
mod with_arity_2;
#[test]
fn without_arity_2_errors_badarg() {
with_process(|process| {
let destination = process.tuple_from_slice(&[]);
let message = Atom::str_to_term("message");
assert_badarg!(
result(process, destination, message),
format!("destin... |
use std::collections::HashMap;
use std::char;
use track::*;
use token::{Token, TokenData, Exp, CharCase, Sign, NumberLiteral, Radix};
use std::cell::Cell;
use std::rc::Rc;
use context::SharedContext;
use token::{Reserved, Atom, Name};
use eschar::ESCharExt;
use reader::Reader;
use tokbuf::TokenBuffer;
pub type Lex<T... |
use snap;
use std::io;
fn main() {
let stdin = io::stdin();
let stdout = io::stdout();
let mut rdr = stdin.lock();
// Wrap the stdout writer in a Snappy writer.
let mut wtr = snap::write::FrameEncoder::new(stdout.lock());
io::copy(&mut rdr, &mut wtr).expect("I/O operation failed");
}
|
#[doc = "Description cluster[n]: Write access to peripheral region n detected"]
pub struct WA {
register: ::vcell::VolatileCell<u32>,
}
#[doc = "Description cluster[n]: Write access to peripheral region n detected"]
pub mod wa;
#[doc = "Description cluster[n]: Read access to peripheral region n detected"]
pub struc... |
use crate::{
component::{NavAgent, NavAgentTarget, SimpleNavDriverTag},
resource::{NavMesh, NavMeshesRes, NavVec3},
};
use core::{
app::AppLifeCycle,
ecs::{Entities, Entity, Join, Read, ReadExpect, ReadStorage, System, WriteStorage},
Scalar,
};
use std::collections::HashMap;
/// nav agents maintain... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[link(name = "windows")]
extern "system" {}
pub type IXamlDirectObject = *mut ::core::ffi::c_void;
pub type XamlDirect = *mut ::core::ffi::c_void;
#[repr(transparent)]
pub struct XamlEventIndex(pub i32);
... |
pub mod landscape;
|
// 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 {
crate::models::ActionDisplayInfo,
failure::{err_msg, Error, ResultExt},
fidl::endpoints::Proxy,
fidl_fuchsia_io::DirectoryProxy,
... |
use clippy_utils::diagnostics::{span_lint, span_lint_and_help};
use clippy_utils::{get_trait_def_id, paths};
use if_chain::if_chain;
use rustc_hir::def_id::DefId;
use rustc_hir::{Expr, ExprKind, StmtKind};
use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::ty;
use rustc_middle::ty::{GenericPredicates, Predi... |
use proconio::input;
use segment_tree::SegmentTree;
fn main() {
input! {
w: u32,
_h: u32,
n: usize,
mut pq: [(u32, u32); n],
n_a: usize,
mut a: [u32; n_a],
n_b: usize,
b: [u32; n_b],
};
a.push(w);
pq.sort();
let mut xy = Vec::new();
... |
use std::env;
use clap::Clap;
#[macro_use]
extern crate log;
mod tcp_client;
mod tcp_server;
mod udp_client;
mod udp_server;
#[derive(Clap)]
struct Opts {
protocol: String,
role: String,
address: String
}
fn main() {
let opts: Opts = Opts::parse();
env::set_var("RUST_LOG", "debug");
env_logg... |
use crate::error::Result;
use crate::mapper::{Kind, Mapper};
use crate::sstable::{Key, Merged, SSTable, Value};
use std::collections::btree_map::Entry;
use std::collections::BTreeMap;
use std::mem;
/// Wrapper over a BTreeMap<`Key`, `Value`> that does basic accounting of memory usage
/// (Doesn't include BTreeMap inte... |
extern crate clap;
use clap::{App, Arg};
use std::fs;
fn capitalize(path: &str) -> Result<(), String> {
match fs::read_to_string(path) {
Ok(contents) => {
match fs::write(path, contents.to_uppercase()) {
Ok(_) => Ok(()),
Err(err) => Err(format!("Error writing `... |
///! This module defines a Low-Level IR
use std::borrow::Cow;
use std::convert::{TryFrom, TryInto};
use std::num::NonZeroU32;
use std::{error, fmt, iter};
use itertools::Itertools;
use num::bigint::BigInt;
use num::rational::Ratio;
use crate::ir;
use crate::search_space::{InstFlag, MemSpace};
/// Checks that all the... |
mod shape;
pub use shape::*;
mod bound;
pub use bound::*;
mod target;
pub use target::*;
mod mapper;
pub use mapper::*;
mod select;
#[cfg(test)]
pub mod test;
|
use syn;
use quote::quote;
use std::io::Read;
use std::fs::File;
fn main() {
let filename = "src/test_file.rs";
let mut file = File::open(&filename).expect("Unable to open file");
let mut src = String::new();
file.read_to_string(&mut src).expect("Unable to read file");
let syntax = syn::parse_fi... |
#[doc = "Reader of register DSI_VNPCCR"]
pub type R = crate::R<u32, super::DSI_VNPCCR>;
#[doc = "Reader of field `NPSIZE`"]
pub type NPSIZE_R = crate::R<u16, u16>;
impl R {
#[doc = "Bits 0:12 - Null Packet Size"]
#[inline(always)]
pub fn npsize(&self) -> NPSIZE_R {
NPSIZE_R::new((self.bits & 0x1fff)... |
extern crate dependencies;
// extern crate rustc_serialize;
#[macro_use]
extern crate log;
pub use self::dependencies::rustc_serialize;
pub mod evolution;
pub mod network;
|
//! Serde (de)serialization of worlds.
//!
//! As component types are not known at compile time, the world must be provided with the
//! means to serialize each component. This is provided by the [`WorldSerializer`] implementation.
//! This implementation also describes how [`ComponentTypeId`](super::storage::Component... |
use log::*;
use crate::{
sync::{atomics::AtomicBox, treiber::TreiberStack},
table::prelude::*,
};
use std::{
sync::atomic::{AtomicU64, Ordering},
thread,
};
use thread::ThreadId;
use super::errors::*;
use super::readset::ReadSet;
use super::utils;
use crate::sync::ttas::TTas;
use std::cell::RefCell;
... |
use crate::math::Vec3;
pub struct Ray {
pub origin: Vec3,
pub direction: Vec3,
}
impl Ray {
pub fn point_at(&self, distance: &f64) -> Vec3 {
&self.origin + &(&self.direction * distance)
}
}
#[cfg(test)]
mod tests {
use super::Ray;
use crate::math::Vec3;
#[test]
fn point_at() ... |
use crate::backend::c;
use linux_raw_sys::general::membarrier_cmd;
/// A command for use with [`membarrier`] and [`membarrier_cpu`].
///
/// For `MEMBARRIER_CMD_QUERY`, see [`membarrier_query`].
///
/// [`membarrier`]: crate::process::membarrier
/// [`membarrier_cpu`]: crate::process::membarrier_cpu
/// [`membarrier_q... |
use crate::prelude::*;
use super::super::raw_to_slice;
use std::os::raw::c_void;
use std::ptr;
pub struct VkPhysicalDeviceMemoryBudgetPropertiesEXT {
pub sType: VkStructureType,
pub pNext: *const c_void,
pub heapBudget: [VkDeviceSize; VK_MAX_MEMORY_HEAPS as usize],
pub heapUsage: [VkDeviceSize; VK_MA... |
pub struct Solution;
impl Solution {
pub fn remove_duplicate_letters(s: String) -> String {
let v = s
.bytes()
.map(|b| (b - b'a') as usize)
.collect::<Vec<usize>>();
let mut last = vec![false; v.len()];
let mut exists = vec![false; 26];
for i in ... |
use P37::totient;
pub fn main() {
println!("{}", totient(10));
}
|
use ::{TypeVariant, TypeData, WeakTypeContainer, Result};
use ::ir::TargetType;
use super::VariantType;
#[derive(Debug)]
pub struct TerminatedBufferVariant {
}
impl TypeVariant for TerminatedBufferVariant {
fn get_type(&self, _data: &TypeData) -> VariantType {
VariantType::TerminatedBuffer
}
defa... |
type Choice = bool;
pub struct Player {
pub strat: Box<Strategy>
}
impl Player {
fn new<T: Strategy>(s: T) -> Self {
Player { strat: Box::new(s) }
}
}
pub trait Strategy {
// Static method signature; `Self` refers to the implementor type.
fn new() -> Self;
/// return the strategy's ne... |
use serde::{Deserialize, Serialize};
use crate::hook::Hook;
use crate::stream_square_hook::StreamSquareHook;
#[derive(Debug, Serialize, Deserialize)]
pub struct StreamSquareHookField {
pub (crate) hook: StreamSquareHook
}
impl StreamSquareHookField {
pub fn new(hook_ask_stream_start_method:String, hook_ask_s... |
struct Element<K: PartialOrd, V> {
pub key: K,
pub value: V,
}
pub struct Heap<K: PartialOrd, V> {
elements: Vec<Element<K,V>>,
}
fn father_index(element_index: usize) -> usize {
return (element_index + 1) / 2 - 1;
}
fn child_index_l(element_index: usize) -> usize {
return (element_index + 1) * 2 -... |
#[macro_use]
extern crate log;
extern crate argparse;
extern crate env_logger;
extern crate hyper;
extern crate mozprofile;
extern crate mozrunner;
extern crate regex;
extern crate rustc_serialize;
#[macro_use]
extern crate webdriver;
use std::borrow::ToOwned;
use std::process::exit;
use std::net::{SocketAddr, SocketA... |
use super::{Float, Floating};
use crate::common::*;
typ! {
pub fn Reduce<input>(input: Floating) -> Floating {
match input {
#[generics(base: Unsigned + NonZero, sig: Integer, exp: Integer)]
Float::<base, sig, exp> => {
if sig != 0 && sig % base == 0 {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.