text stringlengths 8 4.13M |
|---|
//! A library to drive web browsers using the webdriver
//! interface.
use std::convert::From;
use std::io::Read;
use std::io;
use std::fmt;
use std::marker::PhantomData;
extern crate hyper;
use hyper::client::*;
use hyper::Url;
extern crate serde;
use serde::{Serialize, Deserialize};
extern crate serde_json;
pub u... |
// 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 ... |
use thiserror::Error;
#[derive(Error, Debug, PartialEq)]
pub enum ReadValueError {
#[error("Attempted to read {0} bytes when parsing {1}")]
BufferToShort(usize, &'static str),
#[error("Could not parse utf8 string")]
StringParseError,
#[error("Invalid packet index: {0}")]
InvalidPacketIndex(u16),
}
|
extern crate cairo;
extern crate fontconfig;
extern crate pango;
use std::convert::TryInto;
use std::collections::HashMap;
use std::str;
use harfbuzz_rs::*;
use pangocairo;
use pangocairo::prelude::FontMapExt;
use regex::Regex;
use std::str::FromStr;
///
///
/// storing line data.
/// - content : the vec of the line... |
/*
* @lc app=leetcode.cn id=443 lang=rust
*
* [443] 压缩字符串
*
* https://leetcode-cn.com/problems/string-compression/description/
*
* algorithms
* Easy (32.93%)
* Total Accepted: 2.9K
* Total Submissions: 8.8K
* Testcase Example: '['a','a','b','b','c','c','c']'
*
* 给定一组字符,使用原地算法将其压缩。
*
* 压缩后的长度必须始终小于或等于... |
// 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 ... |
#[doc = "Reader of register FPR2"]
pub type R = crate::R<u32, super::FPR2>;
#[doc = "Writer for register FPR2"]
pub type W = crate::W<u32, super::FPR2>;
#[doc = "Register FPR2 `reset()`'s with value 0"]
impl crate::ResetValue for super::FPR2 {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Typ... |
use super::math::*;
use super::vec3;
#[derive(Copy,Clone)]
pub enum Axis { X, Y, Z }
#[derive(Clone, Copy)]
pub struct Ray {
pub origin: Vec3,
pub direction: Vec3,
}
impl Ray {
pub fn new(origin: Vec3, direction: Vec3) -> Ray {
Ray { origin, direction }
}
pub fn at(&self, t: f32) -> Vec3... |
use std::hash::Hash;
use std::mem;
use std::sync::{Condvar, Mutex};
use std::collections::hash_map::Entry;
use std::collections::HashMap;
use std::collections::VecDeque;
pub trait ToKey {
type Key: Hash + Eq;
fn to_key(&self) -> Self::Key;
}
pub struct RunQueue<T: ToKey> {
cvar: Condvar,
inner: Mutex... |
#[doc = "Reader of register CR"]
pub type R = crate::R<u32, super::CR>;
#[doc = "Writer for register CR"]
pub type W = crate::W<u32, super::CR>;
#[doc = "Register CR `reset()`'s with value 0x80"]
impl crate::ResetValue for super::CR {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
... |
use crate::libbb::default_error_retval::xfunc_error_retval;
use libc;
/* Keeping it separate allows to NOT pull in stdio for VERY small applets.
* Try building busybox with only "true" enabled... */
pub static mut die_func: Option<unsafe extern "C" fn() -> ()> = None;
pub unsafe fn xfunc_die() -> ! {
match die_fu... |
use game::*;
pub fn step_debug(_game: &mut Game1){
}
|
/*! Compression operation, using gzip in default implementatino !*/
use std::{
fs::File,
io::{BufRead, BufReader, Read, Write},
path::{Path, PathBuf},
};
use flate2::{write::GzEncoder, Compression};
use rayon::iter::{IntoParallelIterator, ParallelIterator};
use crate::error::Error;
pub trait Compress {
... |
use super::raw_model::RawModel;
use crate::textures::model_texture::ModelTexture;
pub struct TexturedModel {
raw_model: RawModel,
texture: ModelTexture,
}
impl TexturedModel {
pub fn new(raw_model: RawModel, texture: ModelTexture) -> TexturedModel {
TexturedModel { raw_model, texture }
}
... |
use input_i_scanner::{scan_with, InputIScanner};
fn inv(a: i64, m: i64) -> i64 {
let (x, _, _) = ext_gcd::ext_gcd(a, m);
(x + m) % m
}
fn main() {
let stdin = std::io::stdin();
let mut _i_i = InputIScanner::from(stdin.lock());
let t = scan_with!(_i_i, i64);
let m = 998244353;
let mut ans... |
#![forbid(unsafe_code)]
mod lexer;
mod parser;
mod types;
use lexer::Token;
use logos::Logos;
use parser::parse_expressions;
use types::Var;
fn main() {
let src = "(+ (* x x) (* 2 x))";
let lex = Token::lexer(src);
let lexed: Vec<_> = lex.collect();
let var = Var::new(String::from("x"));
match p... |
// 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 agre... |
use crate::codec::{Decode, Encode};
use crate::{remote_type, Quaternion, RemoteObject, Vector3};
remote_type!(
/// Represents a reference frame for positions, rotations and velocities. Contains:
///
/// * The position of the origin.
/// * The directions of the x, y and z axes.
/// * The linear velocity of the frame.
/... |
//! linux_raw syscalls supporting `rustix::termios`.
//!
//! # Safety
//!
//! See the `rustix::backend` module documentation for details.
#![allow(unsafe_code)]
#![allow(clippy::undocumented_unsafe_blocks)]
use crate::backend::c;
use crate::backend::conv::{by_ref, c_uint, ret};
use crate::fd::BorrowedFd;
use crate::io... |
use cpython::{py_fn, py_module_initializer, PyList, PySet, PyResult, Python};
py_module_initializer!(libmyrustlib, |py, m| {
m.add(py, "__doc__", "This module is implemented in Rust.")?;
m.add(
py,
"sum_as_string",
py_fn!(py, sum_as_string_py(a: i64, b: i64)),
)?;
m.add(py, "len... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - FLASH access control register"]
pub acr: ACR,
_reserved_1_bank1: [u8; 96usize],
_reserved2: [u8; 160usize],
#[doc = "0x104 - Cluster BANK%s, containing KEYR?, CR?, SR?, CCR?, PRAR_CUR?, PRAR_PRG?, SCAR_CUR?, SCAR_PRG?, ... |
use std::io::{Read, Result as IOResult};
use crate::PrimitiveRead;
pub struct StripGroupHeader {
pub verts_count: i32,
pub vert_offset: i32,
pub indices_count: i32,
pub indices_offset: i32,
pub strips_count: i32,
pub strips_offset: i32,
pub flags: u8
}
impl StripGroupHeader {
pub fn read(read: &mu... |
#![allow(dead_code)]
use track::*;
use token::{NumberLiteral, Name};
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum Semi {
Inserted,
Explicit(Option<Posn>)
}
impl Untrack for Semi {
fn untrack(&mut self) {
*self = Semi::Explicit(None);
}
}
#[derive(Debug, Eq, PartialEq)]
pub struct Id... |
//! Provides the Splits Component and relevant types for using it. The Splits
//! Component is the main component for visualizing all the split times. Each
//! segment is shown in a tabular fashion showing the segment icon, segment
//! name, the delta compared to the chosen comparison, and the split time. The
//! list ... |
#![allow(unused_imports, dead_code)]
extern crate fnv;
#[macro_use]
extern crate nom;
extern crate rand;
extern crate rayon;
use fnv::FnvHashSet;
use nom::line_ending;
use std::fs::File;
use std::io::{Read, Write};
use std::mem;
mod scs;
mod trie;
use trie::{ACdat, DATrie, Trie};
named!(point<&str, u8>,
map!(opt... |
#![allow(non_snake_case)]
#![cfg(test)]
fn _someFunc<'shorter, 'longer, TA, TB>(shorter: &'shorter TA, b: &'longer TB) where 'longer: 'shorter {}
struct MyRec {}
#[test]
fn Creating_vector_of_references()
{
let longer = MyRec {};
{
let shorter = MyRec {};
_someFunc(&longer, &shorter);
... |
use crate::snapshot::RoomSnapshot;
#[derive(Debug)]
#[allow(dead_code)]
pub enum Command {
MakeSdpOffer {
peer_id: u64,
sdp_offer: String,
},
MakeSdpAnswer {
peer_id: u64,
sdp_answer: String,
},
UpdateTrack {
peer_id: u64,
track_id: u64,
is_... |
mod bench;
mod cli;
use crate::bench::{do_bench_tps, generate_and_fund_keypairs, Config, NUM_DIFS_PER_ACCOUNT};
use morgan::gossipService::{discover_cluster, get_clients};
use std::process::exit;
fn main() {
morgan_logger::setup();
morgan_metricbot::set_panic_hook("bench-tps");
let matches = cli::build_a... |
/// Implementation of tabular
///
use core::*;
use into_tab::*;
use latex_file::LatexFile;
use std::io::BufWriter;
use std::io::Write;
use writable::Writable;
#[derive(Clone)]
pub struct Tabular {
/// Content
content: Vec<Vec<Core>>,
}
impl Tabular {
pub fn new<T: IntoTab>(content: &T) -> Self {
T... |
pub fn reply(phrase: &str) -> String {
PhraseKind::from(phrase).reply()
}
enum PhraseKind {
Normal,
Shout,
Question,
Empty
}
impl PhraseKind {
fn reply(self) -> String {
match self {
PhraseKind::Normal => "Whatever.",
PhraseKind::Shout => "Whoa, chill out!"... |
//! The [`is_read_write`] function.
//!
//! [`is_read_write`]: https://docs.rs/rustix/*/rustix/io/fn.is_read_write.html
use crate::{backend, io};
use backend::fd::AsFd;
/// Returns a pair of booleans indicating whether the file descriptor is
/// readable and/or writable, respectively.
///
/// Unlike [`is_file_read_wr... |
macro_rules! read_csr {
($csr_number:expr) => {
/// Reads the CSR
#[inline]
unsafe fn _read() -> usize {
let r: usize;
asm!("csrr {}, {}", out(reg) r, const $csr_number);
r
}
};
}
macro_rules! read_csr_as {
($register:ident, $csr_number:ex... |
use anyhow::{Result, Error, format_err};
use futures::Future;
use tokio::time::{Duration, timeout};
use serde::de::{IntoDeserializer, Deserialize};
use std::path::Path;
use std::str::FromStr;
use std::{io, fs};
pub fn key_val<K: FromStr, V: FromStr>(s: &str) -> Result<(K, V)> where
K::Err: Into<Error>,
V::Err: Into<... |
// 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.
// core
mod message;
mod node;
mod power_manager;
mod types;
// nodes
mod cpu_control_handler;
mod cpu_stats_handler;
mod temperature_handler;
mod thermal... |
#[macro_use] extern crate log;
extern crate multipart;
extern crate rand;
use multipart::server::Multipart;
use rand::{Rng, ThreadRng};
use std::fs::File;
use std::env;
use std::io::{self, Read};
const LOG_LEVEL: log::LevelFilter = log::LevelFilter::Debug;
struct SimpleLogger;
impl log::Log for Si... |
use bytes::buf::BufMut;
use bytes::BytesMut;
use failure::Error;
use futures_03::prelude::*;
use futures_03::ready;
use futures_03::task::{Context, Poll};
use std::io;
use std::net::SocketAddr;
use std::os::unix::io::AsRawFd;
use std::os::unix::io::RawFd;
use std::pin::Pin;
use tokio::io::PollEvented;
const INITIAL_RD... |
use std::rc::Rc;
use std::cell::RefCell;
use rustbox::Color;
use rendering::renderer_ascii::Representation;
pub trait Element {
fn get_x(&self) -> i64;
fn get_y(&self) -> i64;
fn get_z(&self) -> i64;
fn set_x(&mut self, x: i64);
fn set_y(&mut self, x: i64);
fn set_z(&mut self, x: i64);
fn get_representation(... |
pub mod app;
pub mod config;
pub use app::app::App;
pub use app::config::Config; |
pub mod block;
pub mod builders;
pub mod constants;
pub mod dataflow;
pub mod function;
pub mod instructions;
pub mod layout;
pub mod module;
pub mod value;
pub use self::block::{Block, BlockData};
pub use self::builders::{InstBuilder, InstBuilderBase};
pub use self::constants::{
Constant, ConstantData, ConstantIt... |
// Inspired by https://github.com/dutchcoders/transfer.sh
//
// #![allow(unused_imports)]
// #![allow(unused_variables)]
// #![allow(dead_code)]
// #![allow(unused_must_use)]
// externs
//
#[macro_use]
extern crate log;
extern crate log4rs;
extern crate clap;
extern crate rand;
extern crate regex;
extern crate num_cp... |
// 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.
#![feature(async_await, await_macro, futures_api)]
#![deny(warnings)]
use failure::{Error, ResultExt};
use fdio;
use fidl_fuchsia_hardware_ethernet as zx_... |
use crate::sim::SimTime;
use std::collections::HashMap;
#[derive(Default)]
pub struct RecastExpirations {
actions: HashMap<u32, SimTime>,
gcd_expiration: SimTime,
}
impl RecastExpirations {
pub fn check_ready(&self, action_id: u32, ogcd: bool, sim_time: SimTime) -> bool {
let ready = (o... |
//! Synchronous native rust database driver for SAP HANA (TM).
//!
//! `hdbconnect` provides a lean, fast, and easy-to-use rust-API for working with
//! SAP HANA. The driver is written completely in rust.
//! It interoperates elegantly with all data types that implement the standard
//! `serde::Serialize` and/or `serd... |
//! End to end test of catalog configurations
use std::{io::Write, path::Path};
use tempfile::TempDir;
use test_helpers_end_to_end::{maybe_skip_integration, MiniCluster, Step, StepTest};
#[tokio::test]
async fn dsn_file() {
test_helpers::maybe_start_logging();
let database_url = maybe_skip_integration!();
... |
fn fib(x: i32) -> i32{
if x<=2{
return 1;
}
return fib(x-1)+fib(x-2);
}
fn main(){
let mut sum: i32=0;
let mut count=0;
loop{
let f=fib(count);
if f > 4000000{
break;
}
if f%2==0{
sum+=f;
}
count+=1;
}
printl... |
use surface::{Surface, SurfaceSession};
pub struct CpuSurface {}
impl CpuSurface {
pub fn new() -> CpuSurface {
CpuSurface {}
}
}
impl Surface for CpuSurface {
type SurfaceSessionType = CpuSurfaceSession;
fn draw_session() -> CpuSurfaceSession {
CpuSurfaceSession {}
}
}
pub stru... |
mod keys;
mod parsing;
mod protocols;
use crate::devices::Controller;
use crate::protocol::Command::Terminate;
pub use keys::*;
use libusb::Error;
pub struct Protocol {
init_packets: Vec<InitPacket>,
}
struct InitPacket {
order: Option<usize>,
after_packet: Option<Vec<u8>>,
content: Vec<u8>,
}
impl ... |
fn main() {
yew::start_app::<node_refs_std_web::Model>();
}
|
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
//
use std::collections::HashMap;
use std::fs;
use std::path::PathBuf;
use clap::{crate_authors, crate_version, App, Arg};
#[derive(Debug, PartialEq)]
pub enum Verbosity {
Quiet,
Normal,
Verbose,
}
#[derive(Debug)]
pub struct WorkOr... |
extern crate simple_examples;
use simple_examples::topic::Topic;
use simple_examples::*;
use std::io;
fn main() {
let map = populate_map();
loop {
println!("Choose an example ('topic, number')");
let mut choice = String::new();
io::stdin().read_line(&mut choice)
.expect(... |
use crate::lexer::*;
pub(crate) mod array;
pub(crate) mod numeric;
pub(crate) mod regex;
pub(crate) mod string;
pub(crate) mod symbol;
pub(crate) use array::array_literal;
pub(crate) use numeric::numeric_literal;
pub(crate) use regex::regular_expression_literal;
pub(crate) use string::string_literal;
pub(crate) use s... |
// 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 crate::log_error::log_error_discard_result;
use crate::session::Session;
use crate::session_id_rights;
use crate::Result;
use crate::CHANNEL_BUFFER_SIZ... |
//! Netinject provides a high level API for creating and deleting iptables rules which drop
//! packets. It's designed to help you test network failure scenarios.
//!
//! It can be used as a library, a script, and has a cleanup method which is specifically designed
//! for use from a daemon which can clean up after its... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[cfg(feature = "Media_AppBroadcasting")]
pub mod AppBroadcasting;
#[cfg(feature = "Media_AppRecording")]
pub mod AppRecording;
#[cfg(feature = "Media_Audio")]
pub mod Audio;
#[cfg(feature = "Media_Capture... |
use std::{collections::HashMap, fmt};
use crate::*;
/// Represents Player of given team
///
/// # See also
///
/// Check <https://www.lux-ai.org/specs-2021#Environment>
#[derive(Clone, fmt::Debug, Default)]
pub struct Player {
/// Researched points of [`Player`]
pub research_points: ResearchPointAmount,
... |
pub mod rasterizationorderamd;
pub mod prelude;
|
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[repr(transparent)]
#[doc(hidden)]
pub struct IMdmAllowPolicyStatics(pub ::windows::core::IInspectable);
unsafe impl ::windows::core::Interface for IMdmAllowPolicyStatics {
type Vtable =... |
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors.
//
// 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 ... |
#[path = "with_function/with_arity_zero.rs"]
mod with_arity_zero;
test_stdout!(without_arity_zero_returns_pid_to_parent_and_child_process_exits_badarity_which_exits_linked_parent, "{parent, badarity}\n");
|
use proptest::strategy::Just;
use crate::erlang::binary_to_list_1::result;
use crate::test::strategy;
#[test]
fn without_binary_errors_badarg() {
run!(
|arc_process| {
(
Just(arc_process.clone()),
strategy::term::is_not_binary(arc_process.clone()),
)... |
use super::{Server, TasksLayer};
use std::{
net::{SocketAddr, ToSocketAddrs},
path::PathBuf,
time::Duration,
};
/// Builder for configuring [`TasksLayer`]s.
#[derive(Clone, Debug)]
pub struct Builder {
/// The maximum capacity for the channel of events from the subscriber to
/// the aggregator task... |
#![doc = "Peripheral access API for FOMU microcontrollers (generated using svd2rust v0.16.1)\n\nYou can find an overview of the API [here].\n\n[here]: https://docs.rs/svd2rust/0.16.1/svd2rust/#peripheral-api"]
#![deny(missing_docs)]
#![deny(warnings)]
#![allow(non_camel_case_types)]
#![no_std]
extern crate bare_metal;
... |
// Copyright 2022 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 front::stdlib::value::{Value, ResultValue, to_value, from_value};
use front::stdlib::function::Function;
use std::io::stderr;
use time::{now, strftime};
/// Print a javascript value to the standard output stream
pub fn log(args:Vec<Value>, _:Value, _:Value, _:Value) -> ResultValue {
let args : Vec<String> = arg... |
use serde_json::json;
use get_if_addrs::get_if_addrs;
use toml::Value;
use toml::map::Map;
use crate::reporters::Report;
pub fn ip_addrs_reporter(_: &Map<String, Value>) -> Report {
let mut ips = vec![];
for iface in get_if_addrs().unwrap() {
let ip = (iface.name, iface.addr.ip());
ips.push(... |
mod colorblindness;
mod glaucoma;
mod macular_degeneration;
mod nyctalopia;
mod osterberg;
mod receptor_density;
use crate::pipeline::*;
pub fn generate_retina_map(resolution: (u32, u32), params: &ValueMap) -> Box<[u8]> {
let mut maps: Vec<image::ImageBuffer<image::Rgba<u8>, Vec<u8>>> = Vec::new();
// glauco... |
// Standard library
use std::collections::{hash_map, HashMap};
use std::str::FromStr;
use std::sync::{Arc, Mutex};
// This crate
use crate::actions::{Action, ActionAnswer, ActionContext};
use crate::exts::LockIt;
use crate::nlu::{EntityData, EntityDef, IntentData, OrderKind, SlotData};
use crate::signals::collections:... |
use spatialos_sdk::worker::internal::schema::*;
use spatialos_sdk::worker::component::*;
use std::collections::BTreeMap;
use <#= vec!["super".to_string(); self.depth() + 1].join("::") #>::generated as generated;
/* Enums. */<# for enum_name in &self.enums {
let enum_def = self.get_enum_definition(enum_name);
let enum... |
extern crate rustc_serialize;
extern crate uuid;
extern crate chrono;
#[macro_use] mod macros;
pub mod parse;
pub mod method;
pub mod record;
pub mod types;
pub use self::mailbox::Mailbox;
pub use self::message::Message;
pub use self::calendar::Calendar;
pub use self::calendar_event::CalendarEvent;
pub use self::con... |
//! This module provides useful **type operators** that are not defined in `core`.
//!
//!
/// A **type operator** that ensures that `Rhs` is the same as `Self`, it is mainly useful
/// for writing macros that can take arbitrary binary or unary operators.
///
/// `Same` is implemented generically for all types; it sho... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[link(name = "windows")]
extern "system" {}
pub type IPerceptionFrameProvider = *mut ::core::ffi::c_void;
pub type IPerceptionFrameProviderManager = *mut ::core::ffi::c_void;
pub type PerceptionControlGro... |
pub mod grid;
use std::fmt::Debug;
use std::time::Instant;
pub fn create_chunks(input: &str) -> Vec<&str> {
input.trim().split("\n\n").collect()
}
pub fn run_timed<T, X>(f: fn(T) -> X, argument: T, description: &str)
where
X: Debug,
{
let now = Instant::now();
let answer = f(argument);
println!... |
// Ideas for interaction:
// player 2 -> switch to player 2's turn
// set ! 42 -> set Yahtzee row to 42 (forced result)
// r 113456 -> roll and suggest actions
// S -> choose action 'S'
//
// Initial roll: "I would keep 56 to go for two pairs"
// Final roll: "I would take the obvious choice: ..." (i.e. the non-Chance o... |
use crate::ir::eval::prelude::*;
impl IrEval for ir::IrCondition {
type Output = bool;
fn eval(
&self,
interp: &mut IrInterpreter<'_>,
used: Used,
) -> Result<Self::Output, IrEvalOutcome> {
match self {
ir::IrCondition::Ir(ir) => Ok(ir.as_bool(interp, used)?),
... |
use std::mem;
use curses;
bitflags! {
flags Buttons: curses::mmask_t {
const BUTTON_RELEASED = curses::BUTTON_RELEASED,
const BUTTON_PRESSED = curses::BUTTON_PRESSED,
const BUTTON_CLICKED = curses::BUTTON_CLICKED,
const DOUBLE_CLICKED = curses::DOUBLE_CLICKED,
const TRIPLE_CLICKED = curses::TRIPLE_CLIC... |
/*
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... |
use serde::{Deserialize, Serialize};
use std::cmp::Ordering;
use std::fmt;
#[derive(Deserialize, Serialize, Clone, Copy, Debug, Hash, Eq, PartialEq)]
pub enum ClearType {
NoPlay,
Failed,
AssistEasy,
LightAssistEasy,
Easy,
Normal,
Hard,
ExHard,
FullCombo,
Perfect,
Max,
Un... |
use std::{collections::HashMap, f32::consts::PI};
use glium::{
index, uniforms::Uniforms, Display, DrawParameters, Frame, IndexBuffer, Program, Surface,
VertexBuffer,
};
use super::Vertex;
pub struct Mesh {
vertices: VertexBuffer<Vertex>,
indices: Vec<IndexBuffer<u32>>,
}
impl Mesh {
pub fn sphe... |
use {
super::{ArcNoiseFn, NoiseFn},
crate::math::Scalar,
};
#[derive(Debug, Clone)]
pub struct ScaledNoise<T: Scalar, P> {
source: ArcNoiseFn<T, P>,
scale_x: T,
scale_y: T,
scale_z: T,
scale_w: T,
}
impl<T: Scalar, P> ScaledNoise<T, P> {
pub fn new(source: ArcNoiseFn<T, P>) -> Self {
... |
use super::{
service::{get_user_path, update_user},
UpdateUserInput,
};
use crate::datastore::prelude::*;
use juniper::ID;
use utils::PathToRef;
pub struct PendingUser {
pub user_id: ID,
pub email: String,
}
impl PendingUser {
fn new(user: Self) -> DbProperties {
fields_to_db_values(&[
... |
#![feature(rustc_private)]
#![warn(unused_extern_crates)]
dylint_linting::dylint_library!();
extern crate rustc_ast;
extern crate rustc_ast_pretty;
extern crate rustc_attr;
extern crate rustc_data_structures;
extern crate rustc_errors;
extern crate rustc_hir;
extern crate rustc_hir_pretty;
extern crate rustc_index;
e... |
//!
use chart_builder::charts::*;
/// Structure used for storing chart related data and the drawing of an Bar Chart.
///
/// Compare values across multiple categories.
#[derive(Clone)]
pub struct VerticalBarChart {
data_labels: Vec<String>,
data: Vec<Vec<f64>>,
pub chart_prop: ChartProp,
pub axis_prop... |
mod message;
pub use message::ErrorMessage;
mod server;
pub use server::ServerError;
mod system;
pub use system::SystemError;
|
// Copyright 2017 Dasein Phaos aka. Luxko
//
// 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. This file may not be copied, modified, or distributed
// except a... |
use mask::*;
#[derive(Eq, Copy, Clone, Debug, Default, PartialEq)]
pub struct WhiteMask(pub Mask);
#[derive(Eq, Copy, Clone, Debug, Default, PartialEq)]
pub struct BlackMask(pub Mask);
pub mod ops_black_on_white;
pub mod ops_white_on_black;
pub mod ops_none_on_white;
pub mod ops_white_on_white;
pub mod ops_black_on_b... |
#[macro_use]
extern crate clap;
mod solve;
use std::time::Instant;
use clap::ArgMatches;
use solve::{solve, SolveStats};
fn main() {
let matches: ArgMatches = clap_app!(myapp =>
(name: "countdown-game")
(version: "0.1.0")
(author: "Mattias Buelens <mattias.buelens@gmail.com>")
(a... |
use ::std::fs;
use std::time::Instant;
pub type CoordType = f64;
//TODO @mverleg: try with and without copy
#[derive(Debug, PartialEq, Clone, Copy)]
pub struct Point {
pub x: CoordType,
pub y: CoordType,
pub z: CoordType,
}
impl Point {
pub fn dist2(&self, other: &Point) -> CoordType {
(self... |
use std::ops::Deref;
use crate::ast::error::{Hint, TypeError};
use crate::ast::SetRef;
use crate::lexer::Spanned;
use fxhash::FxHashMap;
/// CheckContext is a type system.
#[derive(Debug, Default)]
pub struct CheckerContext {
/// Map Name of unique identifiant.
hash_set: FxHashMap<String, Spanned<Hint>>,
... |
fn main(){
println!("{}", factor(600851475142));
}
fn factor(mut x: i64) -> i64{
while x%2==0{
x=x/2;
}
let mut largest: i64 =0;
let mut divisor: i64 = 3;
while divisor <=x{
if x%divisor==0{
x=x/divisor;
if divisor > largest{
largest=divi... |
pub mod response;
use core::fmt;
use std::fmt::{Display, Formatter};
/// What Inbox you want to look at
pub enum WhereMessage {
/// Everything
Inbox,
/// unread
Unread,
/// Sent
SENT,
}
impl Display for WhereMessage {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
let string = ... |
// src: musl/src/fenv/fenv.c
/* Dummy functions for archs lacking fenv implementation */
pub(crate) const FE_UNDERFLOW: i32 = 0;
pub(crate) const FE_INEXACT: i32 = 0;
pub(crate) const FE_TONEAREST: i32 = 0;
#[inline]
pub(crate) fn feclearexcept(_mask: i32) -> i32 {
0
}
#[inline]
pub(crate) fn feraiseexcept(_mas... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Access control register"]
pub acr: ACR,
#[doc = "0x04 - Power down key register"]
pub pdkeyr: PDKEYR,
#[doc = "0x08 - Flash key register"]
pub keyr: KEYR,
#[doc = "0x0c - Option byte key register"]
pub optke... |
use std::error::Error;
type Result<T> = std::result::Result<T, Box<dyn Error>>;
pub mod api;
pub mod applicants;
pub mod applicants_list;
pub mod documents;
pub mod documents_list;
pub mod env;
use api::*;
use applicants::*;
use applicants_list::*;
use documents::*;
use documents_list::*;
pub fn run(api_token: &str... |
pub mod bytecodegen;
mod cfg;
mod dfg;
mod function;
|
use cql_bindgen::cass_tuple_new;
use cql_bindgen::cass_tuple_new_from_data_type;
use cql_bindgen::cass_tuple_free;
use cql_bindgen::cass_tuple_data_type;
use cql_bindgen::cass_tuple_set_null;
use cql_bindgen::cass_tuple_set_int32;
use cql_bindgen::cass_tuple_set_int64;
use cql_bindgen::cass_tuple_set_float;
use cql_bin... |
extern crate openssl;
use algorithm_problem_client::AtCoderClient;
use atcoder_problems_backend::crawler;
use diesel::pg::PgConnection;
use diesel::Connection;
use log::info;
use std::env;
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
simple_logger::init_with_level(log::Level::Info).unwrap();
... |
use std::sync::{Mutex, Condvar, Arc, MutexGuard};
use async_channel::{Receiver, Sender, unbounded};
use sourcerenderer_core::Platform;
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
use web_sys::{DedicatedWorkerGlobalScope, WorkerGlobalScope, Response};
use js_sys::{ArrayBuffer, Uint8Array};
use wasm_bindgen_... |
fn main() {
#[allow(clippy::unusual_byte_groupings)]
if let Ok(v) = std::env::var("DEP_OPENSSL_VERSION_NUMBER") {
println!("cargo:rustc-env=OPENSSL_API_VERSION={v}");
// cfg setup from openssl crate's build script
let version = u64::from_str_radix(&v, 16).unwrap();
if version >= ... |
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use sfxr::Sample;
fn criterion_benchmark(c: &mut Criterion) {
// Default samples
c.bench_function("pickup", |b| {
b.iter(|| {
black_box(Sample::pickup(None));
});
});
c.bench_function("laser", |b| {
... |
use std::fmt;
use std::ops::{Deref, DerefMut};
use serde::{Deserialize, Serialize};
use super::cartridge::Cartridge;
use super::gpu::VIDEO_RAM_SIZE;
use super::iodev::{IoDevices, WaitControl};
use super::{Addr, Bus};
pub mod consts {
pub const WORK_RAM_SIZE: usize = 256 * 1024;
pub const INTERNAL_RAM_SIZE: u... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.