text stringlengths 8 4.13M |
|---|
#[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::TPSTAT {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &... |
// Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
use anyhow::bail;
use anyhow::{ensure, Error, Result};
use logger::prelude::*;
use mirai_annotations::*;
use serde::{Deserialize, Serialize};
use starcoin_crypto::HashValue;
#[cfg(test)]
mod accumulator_test;
pub mod node;
pub mod... |
use std::{
fmt::Display,
task::{
Context,
Poll,
},
time::{
Duration,
Instant
},
str
};
use futures::future::BoxFuture;
use axum::{
body::Body,
response::Response,
http::{
Request,
HeaderValue
},
};
use tower::{
Layer,
Service
};
#[derive(Debug, Default)]
struct Logger... |
// Copyright 2019. The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// disclai... |
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct Error {
pub code: usize,
pub message: String,
}
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", self.message)
}
}
impl std::error... |
use std::collections::HashMap;
use std::hash::Hash;
pub trait ToHashMap<T,K,V, FK, FV>
where K:Hash,
K:Eq,
FK:Fn(&T)->K,
FV:Fn(&T)->V {
fn to_hash_map(self, key_func: FK, value_func: FV) -> HashMap<K, V>;
}
impl<T, K, V, FK, FV, I> ToHashMap<T, K, V, FK, FV> for I
where K: H... |
pub mod imperative_base;
pub mod javascript;
|
pub mod math;
pub use math::WrenVec3;
pub mod light;
pub use light::*;
use glam::vec3;
use ruwren::{get_slot_checked, send_foreign, Class, VM};
pub struct Graphics;
// todo properly raise runtime exception in foreign method
impl Class for Graphics {
fn initialize(_: &VM) -> Self {
panic!("Graphics is a ... |
use oxygengine_composite_renderer::{component::CompositeTransform, math::Vec2};
use oxygengine_core::{
app::AppBuilder,
ecs::{Component, Join, NullStorage, ReadStorage, System, Write, WriteStorage},
hierarchy::Parent,
prefab::{Prefab, PrefabComponent, PrefabManager},
Ignite,
};
use oxygengine_physic... |
use super::conf::{CConf, Rc33M};
use super::nav::CursorNav;
use node::Node;
use traits::{Leaf, PathInfo, SubOrd};
use mines::SliceExt; // for boom_get
use arrayvec::ArrayVec;
use std::fmt;
/// An object that can be used to traverse a `Node`.
///
/// `Cursor` is very lightweight. All operations are done entirely usin... |
use std::cmp::Ordering;
use std::collections::BTreeMap;
use std::fmt::Display;
use std::ops::Add;
use crate::cost::{DVValue, Cost};
use std::slice::Iter;
use std::io::Write;
use std::fs::File;
use std::path::Path;
use std::error::Error;
use std::process::Command;
use std::fs;
impl<W: Ord + Clone + Add<Output=W> + Dis... |
#[derive(Default, Debug)]
struct Node {
children: Vec<Node>,
metadata: Vec<usize>,
}
impl Node {
fn part1_total(&self) -> usize {
let mut total = 0;
for metadata in &self.metadata {
total += metadata;
}
for node in &self.children {
total += node.part1... |
use std::{fmt, str};
#[derive(Debug, Clone)]
pub enum Error {
InvalidAppEui,
InvalidAppKey,
InvalidDevEui,
InvalidApiKey,
InvalidUuid,
NewDevice422,
NewDeviceApi,
NewLabel422,
NewLabelApi,
NewDeviceLabelApi,
UnauthorizedApi,
HttpErrorApi,
}
impl fmt::Display for Error {... |
// Copyright 2017 rust-ipfs-api Developers
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except accord... |
use crate::grid_builder::*;
use std::fmt::*;
use std::marker::PhantomData;
/// A builder used to create plain-text table from row values.
///
/// Generate a table using the columns defined by [`CellsFormatter`].
///
/// # Examples
///
/// ```
/// use text_grid::*;
/// struct RowData {
/// a: u32,
/// b: u32,
//... |
pub mod mesh;
#[macro_use]
pub mod prim;
#[macro_use]
pub mod util;
pub mod examples;
pub mod xform;
//pub use crate::examples;
//pub use crate::openmesh::test_thing;
#[cfg(test)]
mod tests {
use super::*;
use nalgebra::*;
use std::rc::Rc;
use std::time::Instant;
#[test]
fn xform_order() {
... |
// 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 ... |
//! Metrics instrumentation for [`Cache`]s.
use std::{fmt::Debug, sync::Arc};
use async_trait::async_trait;
use iox_time::{Time, TimeProvider};
use metric::{Attributes, DurationHistogram, U64Counter};
use observability_deps::tracing::warn;
use trace::span::{Span, SpanRecorder};
use super::{Cache, CacheGetStatus, Cach... |
#![feature(inclusive_range_syntax)]
#![feature(box_syntax)]
#![feature(test)]
extern crate test;
extern crate bincode;
extern crate serde;
mod move_;
mod cube;
mod coordinate;
mod solver;
use std::env;
use move_::UserMove;
use cube::Cube;
use coordinate::Coordinate;
use solver::Solver;
fn main() {
let first_arg... |
use std::convert::{TryFrom, TryInto};
use std::fmt;
use std::mem;
use std::sync::Arc;
use anyhow::*;
use thiserror::Error;
use crate::borrow::CloneToProcess;
use crate::erts::exception::ErlangException;
use crate::erts::process::alloc::TermAlloc;
use crate::erts::process::trace::Trace;
use crate::erts::term::prelude:... |
use std::collections::VecDeque;
use std::net::TcpListener;
use std::os::unix::io::{AsRawFd, RawFd};
use std::ptr;
use std::sync::Mutex;
use io_uring::opcode::types;
use io_uring_callback::{Builder, IoHandle, IoUring};
use lazy_static::lazy_static;
lazy_static! {
static ref TOKEN_QUEUE: Mutex<VecDeque<(Token, i32)... |
use std::fs::File;
use std::io::{BufRead, BufReader, Write};
use std::path::Path;
use std::env;
use std::borrow::Cow;
pub mod snowball;
use snowball::SnowballEnv;
fn usage(name: &str) {
println!("{} -l <language> [-i <input file>] [-o <output file>]
The input file consists of a list of words to be stemmed, one ... |
use std::{sync::Arc, time::Duration};
use tokio::sync::Barrier;
use crate::{
cache::{CacheGetStatus, CachePeekStatus},
loader::test_util::TestLoader,
test_util::{AbortAndWaitExt, EnsurePendingExt},
};
use super::Cache;
/// Interface between generic tests and a concrete cache type.
pub trait TestAdapter:... |
use lsp_text::RopeExt;
pub fn diagnostics(tree: &tree_sitter::Tree, content: &ropey::Rope) -> Vec<lsp::Diagnostic> {
let mut diagnostics = vec![];
let mut work = vec![tree.root_node()];
let mut cursor = tree.root_node().walk();
while let Some(node) = work.pop() {
let range = {
let ... |
use axum_lib as axum;
use axum::{body::Body, http::Response, response::IntoResponse};
use http::{header, StatusCode};
use crate::binding::http::builder::adapter::to_response;
use crate::event::Event;
impl IntoResponse for Event {
type Body = Body;
type BodyError = <Self::Body as axum::body::HttpBody>::Error;... |
pub mod redis_pool;
|
use std::collections::HashMap;
struct NucleotideMap(HashMap<char, usize>);
impl NucleotideMap {
fn new() -> Self {
let mut map = HashMap::new();
for c in ['A', 'T', 'C', 'G'].into_iter() {
map.insert(*c, 0);
}
NucleotideMap(map)
}
}
pub fn count(nucleotide: char, d... |
use fake::Dummy;
use stark_hash::Felt;
use crate::{ToProtobuf, TryFromProtobuf};
use super::common::{BlockBody, BlockHeader};
use super::proto;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Message {
NewBlockHeader(NewBlockHeader),
NewBlockBody(NewBlockBody),
NewBlockState(NewBlockState),
}
impl Messa... |
use crate::{InputType, InputValueError};
pub fn chars_min_length<T: AsRef<str> + InputType>(
value: &T,
len: usize,
) -> Result<(), InputValueError<T>> {
if value.as_ref().chars().count() >= len {
Ok(())
} else {
Err(format!(
"the chars length is {}, must be greater than or ... |
use gl::types::*;
use super::{ShaderExt, Shader};
use anyhow::Result;
pub type GeometryShader = Shader<Geometry>;
pub struct Geometry();
impl ShaderExt for Geometry {
fn new() -> Geometry {
Geometry{}
}
fn ty() -> GLenum {
gl::GEOMETRY_SHADER
}
fn name() -> &'static str {
... |
#[macro_use] extern crate nom;
mod client;
mod dispatcher;
mod message;
mod parser;
mod event_listener;
use std::net::{TcpListener, TcpStream};
use std::io;
use std::thread;
use std::sync::mpsc;
fn spawn_client(conn: TcpStream, notify: mpsc::Sender<dispatcher::Message>) -> thread::JoinHandle<Result<(), client::Clie... |
use serde::ser;
use super::{
error::{Error, Result},
eth::Fixed,
};
pub struct BasicEthSerializer {
/// offset keeps track of the current position
offset: i8,
/// offset_sign is the sign to move the offset forward.
/// Use -1 for big endian arrays and 1 for little endian arrays
offset_sig... |
use std::rc::Rc;
use std::fmt;
use std::ops::Deref;
use std::collections::VecDeque;
#[derive(Debug, Clone)]
enum Operator {
Add,
Subtract,
Multiply,
Divide
}
const NUM_OPERATORS: usize = 4;
impl fmt::Display for Operator {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self ... |
use irust_api::GlobalVariables;
use rscript::{scripting::Scripter, Hook, ScriptType, VersionReq};
struct Prompt;
impl Scripter for Prompt {
fn script_type() -> ScriptType {
ScriptType::OneShot
}
fn name() -> &'static str {
"prompt"
}
fn hooks() -> &'static [&'static str] {
... |
#![allow(clippy::many_single_char_names)]
use super::*;
// TODO: move tool-specific code gen into the tool itself to avoid carrying this extra code in the shared crates?
pub fn gen_sys(tree: &TypeTree, gen: &Gen) -> TokenStream {
let functions = gen_functions(tree, gen);
let types = gen_types(tree, gen);
... |
#![feature(core_intrinsics)]
extern crate core;
extern crate ahci;
extern crate uio;
extern crate mmap;
extern crate driverkit;
use mmap::*;
use ahci::*;
use ahci::fis::*;
use std::mem;
use driverkit::mem::DevMem;
use std::thread; // sleep()
use std::time::Duration; // sleep()
use driverkit::Volatile;
use driverkit::... |
#[derive(Debug)]
pub struct MailHeader<'a> {
pub key: &'a [u8],
pub value: &'a [u8],
}
impl<'a> Default for MailHeader<'a> {
fn default() -> Self {
Self {
key: &[],
value: &[],
}
}
}
pub trait MailHeaderMap {
fn get_all_headers(&self, key: &[u8]) -> Vec<&Mai... |
use crate::prelude::*;
#[derive(NativeClass)]
#[inherit(Node)]
pub struct RPopsInstance {
engine: RPopsEngine<Model>,
}
#[methods]
impl RPopsInstance {
fn _init(owner: Node) -> Self {
let mut instance = RPopsInstance { engine: RPopsEngine::<Model>::new(owner) };
// Add systems
... |
#![feature(proc_macro_hygiene, decl_macro)]
#[macro_use]
extern crate rocket;
mod routes;
mod subprocess_control;
mod types;
mod utils;
use crate::subprocess_control::SubProcessControl;
use rocket_cors::CorsOptions;
fn rocket() -> rocket::Rocket {
rocket::ignite()
.mount("/", routes![routes::hello, rou... |
//! Way Cooler exists in one of several different "Modes"
//! The current mode defines what Way Cooler does in each callback.
//!
//! The central use of this is to define different commands that the user can
//! run.
//!
//! For example, when the lock screen mode is active the user can't do anything
//! other than send... |
// 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 super::heuristics::*;
use super::types::*;
use crate::game::*;
pub fn alphabeta(
game: &Game,
depth: usize,
alpha: f32,
beta: f32,
maximizing_player: Player,
ai_config: &AIConfig
) -> AlgorithmRes {
if depth == ai_config.tree_depth || game.game_over() {
let eval = evaluate_game_state(&game, maxim... |
// 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 ... |
// 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.
//! Represents one node in the mesh. Usually the root of a process.
use {
crate::{
coding::decode_fidl,
labels::{NodeId, NodeLinkId},
... |
/*
Trademark © Robert Horrace (I don't remember and know how to properly trademark it)
This is the Rust program for HW1.
It has a sum, prod, gcd, and lcm
function, and they are called
depending on what the user wants.
The arguments will be the function
name a n-amount of numbers to be
added, multiplied, gcd'd, ... |
/* ITL: Intermediate Tiny Language */
use std::collections::HashMap;
use std::fmt;
use ::ast;
use ::ast::Type;
use ::ast::Operator;
#[derive(Debug,PartialEq,Clone)]
pub enum Direct {
Immediate(i32),
Variable(String),
}
impl Direct {
pub fn to_rval(&self) -> RVal {
match *self {
Direc... |
pub struct RequestError(InternalRequestError);
pub(crate) enum InternalRequestError {
Decode(bitcoin::consensus::encode::Error),
MissingHeader(&'static str),
InvalidContentType(String),
InvalidContentLength(std::num::ParseIntError),
ContentLengthTooLarge(u64),
}
impl From<InternalRequestError> for... |
#[doc = "Reader of register MACRxTxSR"]
pub type R = crate::R<u32, super::MACRXTXSR>;
#[doc = "Reader of field `TJT`"]
pub type TJT_R = crate::R<bool, bool>;
#[doc = "Reader of field `NCARR`"]
pub type NCARR_R = crate::R<bool, bool>;
#[doc = "Reader of field `LCARR`"]
pub type LCARR_R = crate::R<bool, bool>;
#[doc = "R... |
#![deny(rust_2018_idioms)]
use libp2p::identity::Keypair;
fn main() -> anyhow::Result<()> {
let keypair = Keypair::generate_ed25519();
let private_key = keypair.to_protobuf_encoding()?;
let encoded_private_key = base64::encode(private_key);
println!("{encoded_private_key}");
Ok(())
}
|
//! Cells in the cellular automaton.
use crate::rules::Rule;
use derivative::Derivative;
use std::{
cell::Cell,
fmt::{Debug, Error, Formatter},
ops::{Deref, Not},
};
#[cfg(feature = "serialize")]
use serde::{Deserialize, Serialize};
/// Possible states of a known cell.
///
/// During the search, the stat... |
//! ```elixir
//! {:ok, document} = Lumen.Web.Document.new()
//! {:ok, existing_child} = Lumen.Web.Document.create_element(document, "table")
//! {:ok, parent} = Lumen.Web.Document.create_element(parent_document, "div")
//! :ok = Lumen.Web.Node.append_child(document, parent)
//! :ok = Lumen.Web.Node.append_child(parent... |
mod error;
use error::{Error, Result};
use serde::{de::Visitor, Deserialize};
struct OerDeserializer<'de> {
input: &'de [u8],
}
impl<'de> OerDeserializer<'de> {
fn from_oer_bytes(input: &'de [u8]) -> Self {
Self { input }
}
}
pub fn from_oer_bytes<'a, T>(input: &'a [u8]) -> Result<T>
where
T... |
use reqwest;
//move client up lazy_static
pub struct UserPreference {
pub mode : String,
pub category : String,
pub time : String,
pub day : String,
}
pub fn register_preference(user_pref : &UserPreference) {
let json_user_pref = json!( {
"mode" : user_pref.mode,
"category" : user_... |
pub mod helpers{
use crate::image_rect;
use crate::SortKey;
#[derive(Debug)]
pub struct ImageHelper{
pub size: u32,
pub id: u32,
}
pub fn sort(list: &mut Vec<image_rect::image::ImageRect>, key: SortKey){
match key{
SortKey::Height =>
... |
use lettre::smtp::authentication::{Credentials, Mechanism};
use lettre::smtp::ConnectionReuseParameters;
use lettre::{SmtpClient, Transport};
use lettre_email::Email;
use log::info;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
pub struct ContactMail {
pub sender_address: String,
pub m... |
//! Safe wrappers for memory-accessing functions like `std::ptr::copy()`.
use std::ptr;
macro_rules! idx_check (
($slice:expr, $idx:expr) => {
assert!($idx < $slice.len(),
concat!("`", stringify!($idx), "` ({}) out of bounds. Length: {}"),
$idx, $slice.len());
}
);
macro_rules!... |
fn main() {
println!("Hello, World to rust!!!")
} |
#[macro_export]
macro_rules! js(
($global:expr, {
$( $name:tt: $value:expr ),+
}) => ({
let value = Value::new_obj(Some($global));
$(
value.set_field($name, js!($value));
)*
value
});
($global:expr, {
$name:tt: $value:expr
}) => ({
let value = Value::new_obj(Some($global));
... |
// Copyright 2013 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 std::collections::HashMap;
use super::design_space::DPoint;
use super::point::{EntityId, PathPoint, PointType};
use super::point_list::{PathPoints, RawSegment};
use druid::kurbo::{BezPath, PathEl};
use druid::Data;
/// A single bezier path.
///
/// This does not contain subpaths, but a glyph can contain multiple ... |
// This is a test for issue #109.
use std;
fn slice[T](e: vec[T]) {
let result: vec[T] = std::vec::alloc[T](1 as uint);
log "alloced";
result += e;
log "appended";
}
fn main() { slice[str](["a"]); } |
use chrono::{DateTime, Local};
#[derive(Debug)]
pub enum Condition {
Sunny,
PartiallyCloudy,
Cloudy,
Raining,
Stormy,
}
#[derive(Debug, Eq, PartialEq)]
pub enum TargetDate {
Now,
Hourly(DateTime<Local>),
Daily(DateTime<Local>),
}
#[derive(Debug)]
pub struct Forecast {
pub collecte... |
//! Utilities for use with [futures](https://docs.rs/futures/0.1.25/futures/) and
//! [tokio](https://docs.rs/tokio/0.1.15/tokio/).
use futures::prelude::*;
use std::{collections::HashMap, hash::Hash};
/// A higher-level version of `tokio_threadpool::blocking`.
#[cfg(all(feature = "tokio", feature = "tokio-threadpool... |
extern crate hyper;
use std::io::Read;
use self::hyper::Client;
use self::hyper::Url;
use self::hyper::header::*;
static PARSE_APP_ID_HEADER_KEY: &'static str = "X-Parse-Application-Id";
static PARSE_API_KEY_HEADER_KEY: &'static str = "X-Parse-REST-API-Key";
static PARSE_LOGIN_URL_TEMPLATE: &'static str = "https://... |
use crate::embded_lexer::tokenization::Token;
pub type Identifier = String;
use std::fmt;
pub struct Program { pub statements: Vec<Statement>, }
impl Program {
pub fn new() -> Program {
Program {
statements: Vec::new(),
}
}
}
#[derive(Debug, Clone, PartialEq)]
pub enum Statement {... |
use openexr_sys as sys;
use std::os::raw::{c_char, c_int};
bitflags::bitflags! {
/// The version flags represents the options that are supported in the library and the EXR file.
///
pub struct VersionFlags: i32 {
/// File is tiled
///
const TILED = 0x00000200;
/// File conta... |
use std::collections::HashSet;
use std::convert::TryFrom;
use std::io::BufRead;
use anyhow::anyhow;
use anyhow::bail;
use anyhow::ensure;
use anyhow::Context;
use anyhow::Result;
use bitflags::bitflags;
use hex;
use maplit::hashset;
use crate::java::DataInput;
pub type Checksum = [u8; 20];
#[derive(Clone, Debug, Ha... |
use amethyst::{
ecs::prelude::{Component, DenseVecStorage, Entity},
prelude::*,
assets::{Loader},
ui::{Anchor, LineMode, TtfFormat, UiText, UiTransform},
};
use crate::component::def::Hand;
pub struct Game{
pub current_state: CurrentState,
pub user_action: UserAction,
pub player_hand: Hand,
pub oppone... |
/*
Part 1
Review a sequence of digits (your puzzle input) and find the sum of all digits that match the next digit in the list. The list is circular, so the digit after the last digit is the first digit in the list.
For example:
1122 produces a sum of 3 (1 + 2) because the first digit (1) matches the second digi... |
// REF:: https://github.com/mrdoob/three.js/blob/dev/src/math/Quaternion.js
use super::{Mat4, Vec3};
pub struct Quat {
pub x: f32,
pub y: f32,
pub z: f32,
pub w: f32,
}
impl Quat {
pub fn new() -> Self {
Self {
x: 0.0,
y: 0.0,
z: 0.0,
w: 1.0,
}
}
pub fn set(&mut self, x: f32, y: f32, z: f32, w... |
fn first_nonsum(preamble_len: usize, nums: &[u64]) -> u64 {
for i in preamble_len.. {
if !sum_of_prev2(i, preamble_len, nums) {
return nums[i];
}
}
panic!("No nonsum");
}
fn sum_of_prev2(idx: usize, n_prev: usize, nums: &[u64]) -> bool {
find_sum2(nums[idx], &nums[idx - n_pr... |
// Copyright 2012-2014 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-MI... |
use crate::btree::key_value::{KeyType, KeyValuePair, ValueType};
use crate::btree::record_file::RecordFile;
use std::error::Error;
pub struct WAL<'d, K: KeyType<'d>, V: ValueType<'d>> {
file: RecordFile<'d, K, V>,
}
impl<'d, K: KeyType<'d>, V: ValueType<'d>> WAL<'d, K, V> {
pub fn new(
file_path: &Str... |
pub mod toboggan_trajectory_part_1;
pub mod toboggan_trajectory_part_2;
|
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[cfg(feature = "Win32_UI_Controls_Dialogs")]
pub mod Dialogs;
#[cfg(feature = "Win32_UI_Controls_RichEdit")]
pub mod RichEdit;
pub const ACM_ISPLAYING: u32 = 1128u32;
pub const ACM_OPEN: u32... |
extern crate json_typegen_shared;
use std::os::raw::c_char;
use std::ffi::CStr;
use std::ffi::CString;
fn my_string_safe(i: *mut c_char) -> String {
unsafe {
CStr::from_ptr(i).to_string_lossy().into_owned()
}
}
#[no_mangle]
pub fn uppercase(i: *mut c_char) -> *mut c_char {
let input = my_string_saf... |
use monitor::file;
use os;
use std::io;
use std::io::Error;
use std::process::{Command, Child};
use serde_json;
type CmdArgs = Vec<Vec<String>>;
type CmdEnv = Vec<Vec<String>>;
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct ProcessData {
pub name: String,
pub cmd: String,
#[serde(default)]
... |
use libc;
extern "C" {
#[no_mangle]
fn __assert_rtn(
_: *const libc::c_char,
_: *const libc::c_char,
_: libc::c_int,
_: *const libc::c_char,
) -> !;
#[no_mangle]
fn memcmp(_: *const libc::c_void, _: *const libc::c_void, _: libc::c_ulong) -> libc::c_int;
#[no_mangl... |
pub use self::sin::SinSource;
mod sin;
pub use self::xor::XORSource;
mod xor;
use af::{Dim4, Array, DType};
use std::cell::{RefCell, Cell};
use utils;
#[derive(Clone)]
pub struct Data {
pub input: RefCell<Box<Array>>,
pub target: RefCell<Box<Array>>,
}
#[derive(PartialEq, Clone, Debug)]
pub struct DataParams {... |
use mtree::MTree;
/// Parses string and construct MTree.
/// BNF syntax:
/// <Value> ::= Character
/// <Node> ::= <Value> <Children>
/// <Children> ::= '^' | <Node> <Children>
pub fn str_to_tree(s: &str) -> MTree {
fn parse_node(s: &str) -> (MTree, &str) {
let (c, last) = next_token(s);
let ... |
use std::{
fmt::{Debug, Display},
sync::Arc,
};
use async_trait::async_trait;
use datafusion::{error::DataFusionError, physical_plan::ExecutionPlan};
pub mod panic;
pub mod planner_v1;
mod query_chunk;
use crate::{partition_info::PartitionInfo, plan_ir::PlanIR};
/// Creates an [`ExecutionPlan`] for a [`Plan... |
use anyhow::Error;
use futures::prelude::*;
use rskafka::{Consumer, ConsumerConfig};
use tokio::signal;
#[tokio::main]
async fn main() -> Result<(), Error> {
env_logger::Builder::new()
.parse_filters("rskafka::consumer=trace,rskafka::fetch=trace,info") //
.init();
let config = ConsumerConfig {... |
#[doc = r"Value to write to the register"]
pub struct W {
bits: u8,
}
impl super::CSRL0 {
#[doc = r"Writes to the register"]
#[inline(always)]
pub fn write<F>(&self, f: F)
where
F: FnOnce(&mut W) -> &mut W,
{
self.register.set(
f(&mut W {
bits: Self::r... |
#[path = "div_2/with_big_integer_dividend.rs"]
mod with_big_integer_dividend;
#[path = "div_2/with_small_integer_dividend.rs"]
mod with_small_integer_dividend;
test_stdout!(without_integer_dividend_errors_badarith, "{caught, error, badarith}\n{caught, error, badarith}\n{caught, error, badarith}\n{caught, error, badari... |
use crate::models::{CanGetHash, DieselResult, User};
use crate::schema::*;
use crate::MySqlPooledConnection;
use chrono::NaiveDateTime;
use model::{HashSha256, PlayMode, ScoreId};
use std::str::FromStr;
#[derive(Debug, Clone, Queryable, Insertable)]
#[diesel(table_name = score_snaps)]
pub struct ScoreSnap {
pub id... |
use rand::Rng;
use crate::{
networking::state_transition_engine::State,
smb2::requests::{echo::Echo, RequestType},
};
pub mod close_fuzzer;
pub mod create_fuzzer;
pub mod handshake;
pub mod query_info_fuzzer;
/// The fuzzing directive tells the fuzzer which message to fuzz with which
/// fuzzing strategy in ... |
#[derive(Debug)]
enum UsState {
Alabama,
Alaska,
California,
Washington,
}
enum Coin {
Penny,
Nickel,
Dime,
Quarter(UsState),
}
fn value_in_cents(coin: Coin) -> u32 {
match coin {
Coin::Penny => 1,
Coin::Nickel => 5,
Coin::Dime => 10,
Coin::Quarter(s... |
pub mod exp_log;
pub mod exterior_product;
pub mod geometric_product;
pub mod inner_product;
pub mod matrix;
pub mod sandwich;
pub mod sse;
|
use minigrep::{run, Config};
use std::{env, process};
fn main() {
// 注意 std::env::args 在其任何参数包含无效 Unicode 字符时会 panic。
// 如果你需要接受包含无效 Unicode 字符的参数,使用 std::env::args_os 代替。
// 这个函数返回 OsString 值而不是 String 值
// collect 是一个经常需要注明类型的函数
let args: Vec<String> = env::args().collect();
// println!("{:?}... |
use climer::Timer;
#[derive(Default)]
pub struct TimerRes(pub Option<Timer>);
impl TimerRes {
pub fn add_timer(&mut self) {
self.0 = Some(Timer::new(
None,
// Some(Output::new::<char, char>(None, None, None)),
None,
));
}
pub fn remove_timer(&mut self) ... |
pub mod service;
pub mod files;
|
pub mod tuples;
pub mod matrices;
pub mod transformations;
pub mod geometry;
pub mod image;
pub mod raytracer;
pub mod material;
pub mod light;
use image::*;
use transformations::*;
use tuples::*;
use geometry::*;
use raytracer::*;
use light::*;
use material::*;
fn main() {
println!("Ray Tracer!");
let fl... |
// 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 super::poke_type::{TypeInteraction, TypeFactor};
use std::collections::HashMap;
use csv::ReaderBuilder;
use serde::Deserialize;
#[derive(Deserialize)]
struct TypeName{
name: String
}
#[derive(Deserialize)]
struct SerializeTypeFactor{
type_one: String,
type_two: String,
factor: String
}
pub fn g... |
extern crate clap;
use ansi_term::Colour;
use clap::{Arg, Command};
use futures::{stream, StreamExt};
use reqwest::header::{HeaderValue, LOCATION};
use reqwest::{redirect, Response, Url};
use std::collections::HashMap;
use std::fs::File;
use std::io::prelude::*;
use std::io::Write;
use std::path::{Path,PathBuf};
use st... |
use aoc2018::*;
use std::fmt;
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct Pos(i64, i64);
type Order = (i64, i64);
pub type UnitId = usize;
impl Pos {
/// Get the order of the given position.
pub fn order(self) -> Order {
let Pos(x, y) = self;
(y, x)
}
... |
//! A category that contains data about its collection.
//! These are the main stores of the data used by Way Cooler and its clients.
use std::ops::{Deref, DerefMut};
use std::collections::hash_map::HashMap;
use rustc_serialize::json::{Json};
/// The main data mapping between a key and some Json.
pub type DataMap = ... |
#[macro_use]
extern crate criterion;
use criterion::Criterion;
fn linked_hash_map_benchmark(c: &mut Criterion) {
use linked_hash_map::LinkedHashMap;
let mut map = LinkedHashMap::new();
c.bench_function("linked-hash-map_insert/pop-front", move |b| {
b.iter(|| {
for i in 0usize..1000 {
... |
// Copyright 2018 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 sink::Sink;
use {Poll, StartSend, Stream};
/// Sink for the `Sink::sink_map_err` combinator.
#[derive(Clone,Debug)]
#[must_use = "sinks do nothing unless polled"]
pub struct SinkMapErr<S, F> {
sink: S,
f: Option<F>,
}
pub fn new<S, F>(s: S, f: F) -> SinkMapErr<S, F> {
SinkMapErr { sink: s, f: Some(f)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.