text stringlengths 8 4.13M |
|---|
use super::{Dispatch, NodeId, NodeStatus, ShardId, State};
use crate::{NodeQueue, NodeQueueEntry, NodeThreadPool, QueryEstimate, QueryId};
use std::cell::RefCell;
use std::rc::Rc;
use std::time::Duration;
use eyre::{Result, WrapErr};
use ndarray::{Array1, Array2, ArrayView1, ArrayView2};
use optimization::Optimizer;
... |
use std::convert::TryFrom;
use anyhow::Result;
use chrono::Duration;
use futures::future::join_all;
use log::info;
use structopt::StructOpt;
use tokio::task;
use crate::parse::{Response, Ticker};
mod parse;
#[derive(StructOpt, Debug)]
struct Cli {
pub tickers: Vec<String>,
/// Json output
#[structopt(s... |
#![doc(hidden)]
use super::{DefaultFilter, Fetch, IntoIndexableIter, IntoView, ReadOnly, ReadOnlyFetch, View};
use crate::internals::{
entity::Entity,
iter::indexed::IndexedIter,
permissions::Permissions,
query::{
filter::{any::Any, passthrough::Passthrough, EntityFilterTuple},
QueryRes... |
use std::net::{IpAddr, SocketAddr};
use std::time::Duration;
/// Configuration options used to configure a TP-Link device.
///
/// The configuration consists of options that define the protocol that
/// device instances use in order to communicate with the host devices
/// over the local network.
///
/// # Examples
//... |
#![feature(custom_derive, plugin)]
#![plugin(serde_macros)]
#[macro_use] extern crate mrusty;
extern crate rmp;
extern crate rmp_serde;
extern crate rmp_rpc;
extern crate byteorder;
extern crate serde;
extern crate getopts;
mod runner;
mod protocol;
mod api;
use std::os::unix::io::FromRawFd;
use std::os::unix::net::... |
use super::base::BB;
use iterable::Iterable;
use stringable::Stringable;
impl Stringable for BB {
fn to_s(&self) -> String {
let mut s = "".to_string();
let col_names = " |ABCDEFGH|\n";
s = s + col_names;
for (row, col, elem) in self.each_with_row_col() {
if col == 0 {
s.push_str((row+... |
extern crate graph;
use graph::*;
#[test]
fn make_empty() {
let g = Graph::<i32>::new();
assert_eq!(0, g.number_of_vertices());
}
#[test]
fn make_unconnected() {
let g = graph_builders::unconnected(vec![1, 2, 10], false);
assert_eq!(3, g.number_of_vertices());
assert_eq!(1, g.node_from_index(0))... |
use aoc2019::aoc_input::get_input;
use aoc2019::intcode::*;
fn run_program(tape: &Tape, system_id: isize) -> StreamRef {
let mut machine = IntcodeMachine::new_io(
tape.clone(),
new_stream_ref_from(system_id),
new_stream_ref(),
);
match machine.run_to_completion() {
Ok(_) => ... |
// This file is part of linux-epoll. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/linux-epoll/master/COPYRIGHT. No part of linux-epoll, including this file, may be copied, modified, propagated, or distri... |
//! The SMB2 CREATE Response packet is sent by the server to notify
//! the client of the status of its SMB2 CREATE Request.
/// Represents the structure size of the create response.
const STRUCTURE_SIZE: &[u8; 2] = b"\x59\x00";
/// A struct that represents a create response.
#[derive(Debug, PartialEq, Eq, Clone)]
pu... |
use serde::{Serialize,Deserialize};
#[derive(Serialize,Deserialize)]
pub struct AddIP{
pub ip_address:String
}
#[derive(Serialize,Deserialize)]
pub struct RemoveIP{
pub ip_address:String
}
pub struct GetWhiteList;
pub struct GetLocalList;
#[derive(Serialize,Deserialize)]
pub struct ConfirmSecretKey{
p... |
use std::env;
use actix_http::KeepAlive;
use actix_web::{App, get, HttpResponse, HttpServer, middleware::Logger, Result, web};
use couchbase::{Cluster, Collection, GetOptions};
/*use async_std::sync::Arc;*/
/*#[derive(Debug, Clone)]
struct PaceCouchbase (Collection);
*/
#[get("/getDetails/{id}")]
async fn index(
... |
use std::fs::{self, File};
use std::io::prelude::*;
fn main() -> std::io::Result<()> {
let path = "foo.txt";
let mut file = File::create(path)?;
let contents = "Hello, world!";
file.write_all(contents.as_bytes())?;
println!("written = {}", contents);
let mut file = File::open(path)?;
let mut contents =... |
// Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{
tests::suite, vault::VaultStorage, Capability, Error, Identity, KVStorage, Permission, Policy,
Value,
};
/// A test for verifying VaultStorage properly implements the LibraSecureStorage API. This test
/// depends ... |
use core::mem;
use futures::stream::{once, Chain, Once, Stream, StreamFuture};
use futures::{Async, Future, Poll};
/// Drives a stream until just before it produces a value,
/// then performs a transformation on the stream and returns
/// the transformed stream. If the driven stream reaches its
/// end without produci... |
use anyhow::Result;
use clap::{Parser, Subcommand};
use image::io::Reader as ImageReader;
use image::Rgb;
pub mod color;
#[derive(Parser, Debug)]
#[clap(author, version, about, long_about = None)]
struct Cli {
#[clap(subcommand)]
command: Commands,
}
#[derive(Subcommand, Debug)]
enum Commands {
// Gra... |
/*
Copyright (c) 2015, 2016 Saurav Sachidanand
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, di... |
use anyhow::Result;
use std::path::Path;
use crate::{
action::{Action, UserPollDateInfo},
config,
database::{challenge_data::ChallengeData, task_data::TaskData, Database},
response::Response,
};
pub fn perform_action(action: &Action) -> Response {
let database = Database::new(&Path::new(config::D... |
pub type char_t = i8;
pub type uchar_t = u8;
pub type short_t = i16;
pub type ushort_t = u16;
pub type int_t = i32;
pub type uint_t = u32;
pub type long_t = i64;
pub type longlong_t = i64;
pub type ulong_t = u64;
pub type ulonglong_t= i64;
// stddef
pub type ssize_t = long_t;
pub type siz... |
//! # RN2xx3
//!
//! A `no_std` / `embedded_hal` compatible Rust driver for the RN2483 and
//! the RN2903 LoRaWAN modules. The library works without any dynamic allocations.
//!
//! ## Usage
//!
//! First, configure a serial port using a crate that implements the serial
//! traits from `embedded_hal`, for example
//! [... |
use super::error::{PineError, PineErrorKind, PineResult};
use super::input::{Input, Position, StrRange};
use super::state::{AstState, PineInputError};
use super::utils::skip_ws;
use nom::{
bytes::complete::{tag, take_while},
combinator::recognize,
sequence::tuple,
Err,
};
#[derive(Clone, Copy, Debug, P... |
#[macro_export]
macro_rules! morgan_exchange_controller {
() => {
(
"morgan_exchange_controller".to_string(),
morgan_exchange_api::id(),
)
};
}
use morgan_exchange_api::exchange_processor::process_instruction;
morgan_interface::morgan_entrypoint!(process_instruction);
|
use crate::any::{Any, AnyTypeInfo};
use crate::column::{Column, ColumnIndex};
#[cfg(feature = "postgres")]
use crate::postgres::{PgColumn, PgRow, PgStatement};
#[cfg(feature = "mysql")]
use crate::mysql::{MySqlColumn, MySqlRow, MySqlStatement};
#[cfg(feature = "sqlite")]
use crate::sqlite::{SqliteColumn, SqliteRow, ... |
#![allow(dead_code, non_camel_case_types)]
extern crate libc;
pub use self::utmpx::{DEFAULT_FILE,USER_PROCESS,BOOT_TIME,c_utmp};
#[cfg(target_os = "linux")]
mod utmpx {
use super::libc;
pub static DEFAULT_FILE: &'static str = "/var/run/utmp";
pub const UT_LINESIZE: usize = 32;
pub const UT_NAMESIZE:... |
use std::env;
use std::fs;
use std::io::prelude::*;
use std::io::Write;
use std::process::{Command, Stdio};
const BRIGHTNESS_PATH: &str = "/sys/class/backlight/intel_backlight/brightness";
const MAX_BRIGHTNESS_PATH: &str = "/sys/class/backlight/intel_backlight/max_brightness";
fn get_max_brightness() -> f32 {
let... |
extern crate rand;
extern crate num;
use std::cmp;
use num::{BigUint, Zero, One};
use num::bigint::{ToBigUint, RandBigInt};
pub fn main(){
println!("{}",is_probably_prime("8822644427775620595775115476130893017686687877955563534429320360900846719257311242134794074876598682100945768516181513954573564989496411792485... |
use crate::field::FieldElement;
use bitvec::{order::Lsb0, slice::BitSlice};
use ff::Field;
/// An affine point on an elliptic curve over [FieldElement].
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct AffinePoint {
pub x: FieldElement,
pub y: FieldElement,
pub infinity: bool,
}
impl From<&ProjectivePoin... |
use rand;
use rand::Rng;
use core::structs::Point;
use core::structs::MLP;
use std::f64;
pub fn init_weights(neurals: &[i32], max: i32) -> Vec<Vec<Vec<f64>>> {
let mut weights: Vec<Vec<Vec<f64>>> = Vec::new();
for _i in 0..neurals.len() {
let mut v1 = Vec::new();
for _j in 0..max {
... |
use once_cell::sync::Lazy;
use serde_derive::*;
use std::{fs::OpenOptions, io::Read};
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Config {
mirrors: Vec<String>,
}
impl Config {
/// Get a reference to the config's mirrors.
pub fn mirrors(&self) -> &Vec<String> {
&self.mirrors
}
}... |
// Longest Harmonious Subsequence
// https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/584/week-1-february-1st-february-7th/3628/
pub struct Solution;
impl Solution {
pub fn find_lhs(mut nums: Vec<i32>) -> i32 {
nums.sort_unstable();
let mut max_len = 0;
let mu... |
use regex::Regex;
use std::collections::HashSet;
fn main() {
let args: Vec<String> = std::env::args().collect();
let url = &args[1];
let resp = ureq::get(url).call();
if !resp.ok() {
println!("error: status_code={}", resp.status());
return
};
let body = resp.into_string().un... |
//! The HCL2 AST and parser
pub mod ast;
pub mod parser;
pub mod traits;
|
#[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 0"]
impl crate::ResetValue for super::CR {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
... |
use crate::{DocBase, VarType};
const DESCRIPTION: &'static str = r#"
The vwma function returns volume-weighted moving average of x for y bars back. It is the same as: `sma(x * volume, y) / sma(volume, y)`
"#;
const EXAMPLE: &'static str = r#"
```pine
plot(vwma(close, 15))
// same on pine, but less efficient
pine_vwm... |
#[macro_use]
extern crate morgan;
use log::*;
use morgan::treasuryStage::create_test_recorder;
use morgan::blockBufferPool::{create_new_tmp_ledger, Blocktree};
use morgan::clusterMessage::{ClusterInfo, Node};
use morgan::entryInfo::next_entry_mut;
use morgan::entryInfo::EntrySlice;
use morgan::genesisUtils::{create_ge... |
use r2d2_redis::RedisConnectionManager;
/// Pool type is a simple wrapper over r2d2::Pool<RedisConnectionManager> -> use it to pass around your
/// pool.
pub type Pool = r2d2::Pool<RedisConnectionManager>;
pub type Conn = r2d2::PooledConnection<RedisConnectionManager>;
pub fn create_pool(db_url: &str) -> Pool {
l... |
use crate::renderer;
use glium;
use glium::backend::glutin::glutin::GlRequest;
use glium::GlObject;
use openvr;
use std::rc::Rc;
pub struct VrApp {
display: Rc<glium::Display>,
left_eye: VrEye,
right_eye: VrEye,
renderer: renderer::Renderer,
vr_device: VrDevice,
}
impl VrApp {
pub fn new(event... |
use std::os::raw::*;
use std::io::Read;
use std::ffi::CString;
use detour::RawDetour;
use glua_sys::*;
use libloading::os::unix as unix_lib;
mod steam_decoder;
static mut lstate: Option<*mut lua_State> = None;
unsafe fn voice_hook_run(L: *mut lua_State, slot: i32, data: &[u8]) {
static C_HOOK: &str = "hook\0";... |
/**
A very simple application that show your name in a message box.
This demo shows how to use NWG without the NativeUi trait boilerplate.
Note that this way of doing things is alot less extensible and cannot make use of native windows derive.
See `basic` for the NativeUi version and `basic_d` for the... |
use crate::{Song, Note};
use portaudio as pa;
const SAMPLE_RATE: f64 = 44_100.0;
const FRAMES: u32 = 256;
const CHANNELS: i32 = 2;
pub enum Msg {
Play,
Stop,
Song(Song),
}
pub struct Audio {
portaudio: pa::PortAudio,
stream: pa::Stream<pa::NonBlocking, pa::Output<f32>>,
tx: std::sync::mpsc::... |
#![feature(custom_derive, plugin)]
#![plugin(serde_macros)]
extern crate rand;
extern crate serde;
extern crate serde_json;
mod model;
mod utils;
mod init;
use model::names::NameList;
use model::sectors::Sector;
use model::business::Business;
use model::world::World;
fn main() {
let mut world = generate_world()... |
fn main() {
if_expressions(3);
if_expressions(7);
multi_if(6);
multi_if(7);
let _foo = if_statement();
println!("Loop break = {}", loop_break());
while_loop();
for_loop();
range();
}
fn if_expressions(number: i32) {
if number < 5 { // condition must be bool - no auto-conversion
... |
use petgraph::{Graph, Directed};
use petgraph::graph::NodeIndex;
use petgraph::visit::GetAdjacencyMatrix;
use fixedbitset::FixedBitSet;
pub fn cross<N, E>(
graph: &Graph<N, E, Directed>,
matrix: &FixedBitSet,
h1: &Vec<NodeIndex>,
h2: &Vec<NodeIndex>,
) -> u32 {
let mut result = 0;
let n = h1.le... |
fn main() {
println!("Hello, world!");
println!("I am famous");
}
|
#[doc = "Reader of register UR8"]
pub type R = crate::R<u32, super::UR8>;
#[doc = "Reader of field `MEPAD_2`"]
pub type MEPAD_2_R = crate::R<bool, bool>;
#[doc = "Reader of field `MESAD_2`"]
pub type MESAD_2_R = crate::R<bool, bool>;
impl R {
#[doc = "Bit 0 - Mass erase protected area disabled for bank 2"]
#[in... |
use std::borrow::Borrow;
use std::marker::PhantomData;
use hal;
use device::{CommandBuffer, CommandQueue, Device};
use fence;
impl<D, B> Device for (D, PhantomData<B>)
where
B: hal::Backend,
D: Borrow<B::Device>,
{
type Semaphore = B::Semaphore;
type Fence = B::Fence;
type Submit = B::CommandBuff... |
use utopia_core::{
math::Size,
widgets::{pod::WidgetPod, TypedWidget, Widget},
Backend, BoxConstraints,
};
use crate::primitives::quad::QuadPrimitive;
pub struct Background<T, Color, B: Backend> {
widget: WidgetPod<T, B>,
color: Color,
}
impl<T, Color: Default, B: Backend> Background<T, Color, B>... |
// This file is part of linux-epoll. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/linux-epoll/master/COPYRIGHT. No part of linux-epoll, including this file, may be copied, modified, propagated, or distri... |
use std::{
collections::{HashMap, HashSet, VecDeque},
fs, vec,
};
#[derive(Debug, Clone, Copy)]
struct Node {
value: u32,
next: usize,
}
fn main() {
let moves = 100;
let mut nodes = "137826495"
.chars()
.into_iter()
.enumerate()
.map(|(i, x)| Node {
v... |
#[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::RCGCI2C {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, ... |
pub mod connect;
pub mod packets;
pub mod state_transition_engine;
|
use front::run::compiler::Compiler;
use syntax::ast::constant::*;
use syntax::ast::op::*;
use syntax::ast::expr::Expr;
use syntax::ast::constant::Const::*;
use syntax::ast::op::CompOp::*;
use jit::{
// Context,
Compile,
Function,
Value,
get_type,
SysBool,
Int,
UInt,
NInt,
NUInt,
... |
use bevy::{
core::Bytes,
prelude::*,
reflect::TypeUuid,
render::{
mesh::shape,
pipeline::{PipelineDescriptor, RenderPipeline},
render_graph::{base, AssetRenderResourcesNode, RenderGraph, RenderResourcesNode},
renderer::{RenderResource, RenderResourceType, RenderResources}... |
use super::expf;
use super::expm1f;
use super::k_expo2f;
/// Hyperbolic cosine (f64)
///
/// Computes the hyperbolic cosine of the argument x.
/// Is defined as `(exp(x) + exp(-x))/2`
/// Angles are specified in radians.
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn coshf(mut x: f32) -> f32 {
... |
use scanner_proc_macro::insert_scanner;
use std::collections::{BTreeSet, HashMap};
#[insert_scanner]
fn main() {
let (n, m) = scan!((usize, usize));
let a = scan!(u32; n);
let b = scan!(u32; n);
let c = scan!(u32; m);
let d = scan!(u32; m);
let mut chocolate_y = HashMap::new();
for i in 0.... |
use num::BigUint;
pub fn difficulty_to_max_hash(mut difficulty: u64) -> [u8; 32] {
if difficulty == 0 {
difficulty = 1;
}
let mut num = BigUint::from(2u8).pow(32 * 8);
num += BigUint::from(difficulty - 1);
num /= difficulty;
num -= BigUint::from(1u8);
let bytes = num.to_bytes_le();
... |
mod channel_list;
mod chat_history;
mod line_edit;
mod scrollbar;
pub use self::channel_list::ChannelList;
pub use self::chat_history::ChatHistory;
pub use self::line_edit::LineEdit;
pub use self::scrollbar::Scrollbar;
|
use {Matrix, Dict};
use std::io::{BufWriter, BufReader};
use std::io::prelude::*;
use std::fs::File;
use bincode;
use bincode::rustc_serialize::{encode_into, decode_from};
use utils::W2vError;
pub struct Word2vec {
syn0: Matrix,
syn1neg: Matrix,
dim: usize,
dict: Dict,
}
impl Word2vec {
pub fn new(... |
use image::Rgba;
use serde::Deserialize;
use crate::bucket::Pixcel;
use crate::color::alpha_brend;
#[derive(Debug, Clone, Deserialize)]
pub struct Grid {
background: (u8, u8, u8, u8),
#[serde(rename = "grid_base")]
base: (u8, u8, u8),
lines: Vec<GridLine>,
}
impl Grid {
pub fn background(&self, p... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
pub const CLSID_DirectSound: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x47d4d946_62e8_11cf_93bc_444553540000);
pub const CLSID_DirectSound8: ::windows::core::GUID = ::windows:... |
mod file;
mod flags;
pub use self::file::{Async, File, IntoAsync};
pub use self::flags::{AccessMode, CreationFlags, StatusFlags};
|
// auto generated, do not modify.
// created: Mon Feb 22 23:57:02 2016
// src-file: /QtWidgets/qapplication.h
// dst-file: /src/widgets/qapplication.rs
//
// header block begin =>
#![feature(libc)]
#![feature(core)]
#![feature(collections)]
extern crate libc;
use self::libc::*;
// <= header block end
// main block ... |
use yew::prelude::*;
pub struct TabSettings {}
pub enum Msg {}
impl Component for TabSettings {
type Message = Msg;
type Properties = ();
fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self {
TabSettings {}
}
fn update(&mut self, _msg: Self::Message) -> ShouldRender {
... |
use serde_json::{json, Value};
use serde_json::ser::State::Rest;
use rbatis_core::convert::StmtConvert;
use rbatis_core::db::DriverType;
use crate::ast::ast::RbatisAST;
use crate::ast::node::node::{create_deep, do_child_nodes, print_child, SqlNodePrint};
use crate::ast::node::node_type::NodeType;
use crate::ast::node... |
pub use self::store::Store;
use diesel::r2d2::{ConnectionManager, PooledConnection};
use diesel::sql_types::Integer;
use diesel::{self, QueryResult, RunQueryDsl, SqliteConnection};
use std::ops::Deref;
mod models;
mod schema;
mod store;
pub struct Conn(PooledConnection<ConnectionManager<SqliteConnection>>);
impl Con... |
use postgres::{Client, NoTls};
use chrono::{DateTime, Utc};
use std::time::Instant;
use std::collections::BinaryHeap;
use std::cmp::Reverse;
use std::convert::TryFrom;
// IO stuff
use std::io::prelude::*;
use crate::exchange::{Exchange, Market, Order, SecStat, Trade, UserAccount, OrderStatus};
use crate::account::Au... |
#[cfg(not(feature = "lib"))]
use std::{cell::RefCell, rc::Rc};
#[cfg(feature = "lib")]
use mold::Path;
use mold::Raster;
#[cfg(not(feature = "lib"))]
use crate::{Context, PathId, RasterId};
#[derive(Debug)]
pub struct RasterBuilder {
#[cfg(not(feature = "lib"))]
context: Rc<RefCell<Context>>,
#[cfg(not(f... |
//! A glyph embedded in another glyph.
use druid::kurbo::Affine;
use druid::Data;
use norad::GlyphName;
use crate::design_space::DVec2;
use crate::point::EntityId;
#[derive(Debug, Data, Clone)]
pub struct Component {
pub base: GlyphName,
#[data(same_fn = "affine_eq")]
pub transform: Affine,
pub id: E... |
use async_graphql_parser::*;
#[test]
fn test_recursion_limit() {
let depth = 65;
let field = "a {".repeat(depth) + &"}".repeat(depth);
let query = format!("query {{ {} }}", field.replace("{}", "{b}"));
assert_eq!(
parse_query(query).unwrap_err(),
Error::RecursionLimitExceeded
);
}
... |
#[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::ISC {
#[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::fs;
pub struct Index {
hashed_executables: HashMap<String, String>,
}
impl Index {
pub fn new(paths: &[&str]) -> Index {
Index {
hashed_executables: build_index(paths),
}
}
pub fn lookup(&self, key: &str) -> Option<&String> {
... |
pub struct Solution;
impl Solution {
pub fn compare_version(version1: String, version2: String) -> i32 {
let nums1 = version1
.split('.')
.map(|s| s.parse::<i32>().unwrap())
.collect::<Vec<i32>>();
let nums2 = version2
.split('.')
.map(|s|... |
#[doc = "Reader of register MPCBB2_VCTR22"]
pub type R = crate::R<u32, super::MPCBB2_VCTR22>;
#[doc = "Writer for register MPCBB2_VCTR22"]
pub type W = crate::W<u32, super::MPCBB2_VCTR22>;
#[doc = "Register MPCBB2_VCTR22 `reset()`'s with value 0xffff_ffff"]
impl crate::ResetValue for super::MPCBB2_VCTR22 {
type Typ... |
use syn::{Arm, Attribute, Expr, Local, Stmt};
use super::VecExt;
pub(crate) trait Attrs {
fn attrs(&self) -> &[Attribute];
fn any_attr(&self, ident: &str) -> bool {
self.attrs().iter().any(|attr| attr.path.is_ident(ident))
}
fn any_empty_attr(&self, ident: &str) -> bool {
self.attrs(... |
use super::*;
#[test]
fn with_number_second_returns_first() {
run!(
|arc_process| {
(
strategy::term::atom(),
strategy::term::is_number(arc_process.clone()),
)
},
|(first, second)| {
prop_assert_eq!(result(first, second), f... |
#[doc = "Reader of register D1CFGR"]
pub type R = crate::R<u32, super::D1CFGR>;
#[doc = "Writer for register D1CFGR"]
pub type W = crate::W<u32, super::D1CFGR>;
#[doc = "Register D1CFGR `reset()`'s with value 0"]
impl crate::ResetValue for super::D1CFGR {
type Type = u32;
#[inline(always)]
fn reset_value() ... |
#[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::_2_FLTSRC0 {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&... |
use std::fmt::{Debug, Formatter};
use std::time::{SystemTime, UNIX_EPOCH};
use crate::auth::{TokenResponseData, AUTH_CONTENT_TYPE};
use crate::{Authenticator, Authorized, utils};
use async_trait::async_trait;
use log::warn;
use reqwest::header::{HeaderMap, HeaderValue, AUTHORIZATION, CONTENT_TYPE, USER_AGENT};
use req... |
use std::env;
fn main() {
println!("--output--");
let path = env::var("CARGO_EVAL_SCRIPT_PATH").expect("CSSP wasn't set");
assert!(path.ends_with("script-cs-env.rs"));
assert_eq!(env::var("CARGO_EVAL_SAFE_NAME"), Ok("script-cs-env".into()));
assert_eq!(env::var("CARGO_EVAL_PKG_NAME"), Ok("script-cs... |
use std::fmt::{self, Display};
use crate::mysql::protocol::{ColumnDefinition, FieldFlags, TypeId};
use crate::types::TypeInfo;
#[derive(Clone, Debug, Default)]
pub struct MySqlTypeInfo {
pub(crate) id: TypeId,
pub(crate) is_unsigned: bool,
pub(crate) is_binary: bool,
pub(crate) char_set: u16,
}
impl ... |
#![allow(unused_imports)]
/// CD3DX12 Helper functions from here:
/// https://github.com/microsoft/DirectX-Graphics-Samples/blob/master/Samples/Desktop/D3D12HelloWorld/src/HelloTriangle/d3dx12.h
use bindings::{
Windows::Win32::Graphics::Direct3D11::*, Windows::Win32::Graphics::Direct3D12::*,
Windows::Win32::Gra... |
use serde::{Deserialize, Serialize};
use std::process::Command;
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
pub struct ShellCmd {
cmd: String,
args: Vec<String>,
}
impl ShellCmd {
pub fn new(cmd: impl AsRef<str>, args: &[impl AsRef<str>]) -> ShellCmd {
ShellCmd {
cmd: cmd.a... |
//! Implement INode for framebuffer
use core::any::Any;
use kernel_hal::{ColorFormat, FramebufferInfo, FRAME_BUFFER};
use rcore_fs::vfs::*;
/// framebuffer device
#[derive(Default)]
pub struct Fbdev;
impl INode for Fbdev {
#[allow(unsafe_code)]
fn read_at(&self, offset: usize, buf: &mut [u8]) -> Result<usiz... |
pub mod mtac_lora_h_868_eu868;
pub mod mtac_lora_h_915_us915;
|
use super::*;
use proptest::collection::SizeRange;
use crate::test::strategy::NON_EMPTY_RANGE_INCLUSIVE;
#[test]
fn with_empty_list_returns_tail() {
with_process_arc(|arc_process| {
TestRunner::new(Config::with_source_file(file!()))
.run(&strategy::term(arc_process.clone()), |tail| {
... |
/* Copyright 2020 Clément Joly
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
di... |
use std::{cell::RefCell, rc::Rc};
use naia_shared::ActorMutator;
use super::{actor_key::actor_key::ActorKey, mut_handler::MutHandler};
pub struct ServerActorMutator {
key: Option<ActorKey>,
mut_handler: Rc<RefCell<MutHandler>>,
}
impl ServerActorMutator {
pub fn new(mut_handler: &Rc<RefCell<MutHandler>>... |
use eframe::egui;
use eframe::egui::{Response, Ui};
#[cfg_attr(
feature = "persistence",
derive(serde::Deserialize, serde::Serialize, Debug, Clone, PartialEq)
)]
pub enum Wh2Factions {
BM,
BRT,
CH,
DE,
DW,
EMP,
GS,
HE,
LM,
NRS,
SKV,
TK,
VC,
VP,
WE,
... |
// 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 agre... |
#![cfg_attr(not(feature = "std"), no_std)]
extern crate alloc;
use alloc::vec::Vec;
use codec::{Encode, Decode};
use sp_core::U256;
#[cfg(feature = "enable_serde")]
use serde::{Serialize, Deserialize};
#[derive(Encode, Decode)]
pub struct Transfer<AccountId, Balance> {
pub dest: AccountId,
pub amount: Balance,
pu... |
//! `sled` is a flash-sympathetic persistent lock-free B+ tree.
//!
//! ```
//! let config = sled::ConfigBuilder::new().temporary(true).build();
//!
//! let t = sled::Tree::start(config);
//!
//! t.set(b"yo!".to_vec(), b"v1".to_vec());
//! assert_eq!(t.get(b"yo!"), Some(b"v1".to_vec()));
//!
//! t.cas(
//! b"yo!".t... |
use crate::{
buffers::{Buffer, CapacityError, DefaultArguments},
Span, Word,
};
use core::fmt::{self, Debug, Display, Formatter};
/// The general category for a [`GCode`].
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[cfg_attr(
feature = "serde-1",
derive(serde_derive::Serialize, serde_derive::D... |
extern crate r3status;
fn main() {
r3status::run();
}
|
use std::io;
fn cek_prima(bil: i32) -> i32 {
let mut bagi: i32 = 3;
let mut batas: i32 = 0;
let prima = if bil == 1 {
0
}else if bil == 2 || bil == 3 {
1
}else if bil % 2 ==0 {
0
}else {
while batas > bagi {
if bil % bagi == 0 {
return 0
}
batas = bil/bagi;
bagi += 2;
... |
use super::{id, Class, NSUInteger, Object, BOOL, SEL};
use std::{fmt, ops::Deref, ptr::NonNull};
/// The root class for most Objective-C objects.
///
/// See [documentation](https://developer.apple.com/documentation/objectivec/nsobject).
#[repr(transparent)]
#[derive(Clone, Debug)]
pub struct NSObject(id);
impl Deref... |
extern crate cpp_build;
fn main() {
cpp_build::Config::new().include("include").build("src/lldb.rs");
#[cfg(target_os = "linux")]
{
// println!("cargo:rustc-link-search={}", "/usr/lib/llvm-6.0/lib");
// println!("cargo:rustc-link-lib={}", "lldb-6.0");
}
#[cfg(target_os = "macos")]
... |
use fltk::{prelude::*, *};
use fltk_flex::Flex;
fn main() {
let a = app::App::default().with_scheme(app::Scheme::Gtk);
let mut win = window::Window::default().with_size(400, 300);
{
let mut flex = Flex::default().size_of_parent().column();
{
frame::Frame::default(); // filler
... |
use chrono::{DateTime, Local};
use std::collections::HashMap;
use serde::{Serialize, Deserialize};
pub type Symbol = String;
pub type OrderId = i64;
pub type Price = i64;
pub type Qty = i64;
pub type Timestamp = DateTime<Local>;
#[allow(dead_code)]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub enum ... |
pub trait Readable {}
pub trait Writable {}
#[derive(Debug, Copy, Clone)]
pub struct ReadWrite;
impl Readable for ReadWrite {}
impl Writable for ReadWrite {}
#[derive(Debug, Copy, Clone)]
pub struct ReadOnly;
impl Readable for ReadOnly {}
#[derive(Debug, Copy, Clone)]
pub struct WriteOnly;
impl Writable for WriteOnl... |
//! Mods Interface
use std::ffi::OsStr;
use std::path::Path;
use mime::{APPLICATION_OCTET_STREAM, IMAGE_STAR};
use url::{form_urlencoded, Url};
use crate::error::ErrorKind;
use crate::files::{FileRef, Files};
use crate::metadata::Metadata;
use crate::multipart::{FileSource, FileStream};
use crate::prelude::*;
use cra... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.