text stringlengths 8 4.13M |
|---|
#[macro_use]
extern crate bitflags;
pub mod builder;
pub mod format;
pub mod fuzzer;
pub mod gss;
pub mod networking;
pub mod ntlmssp;
pub mod smb2;
|
use std::collections::HashMap;
use walrus::{FunctionBuilder, Module, ModuleConfig, ValType};
#[derive(Debug, Copy, Clone)]
pub enum NodeKind {
Int,
Add,
Negate,
Switch,
Frame,
}
impl NodeKind {
pub fn inputs(&self) -> Vec<String> {
match self {
NodeKind::Int => vec!["v".to... |
// 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 according to those terms.
use g2p::g2p;
g2p!... |
use super::util::*;
use crate::{V, ValueBaseOrdered, ValueBase};
fun!(not(b) {
Ok(V::boo(!as_bool(b)?))
});
fun!(and(b, c) {
Ok(V::boo(as_bool(b)? && as_bool(c)?))
});
fun!(or(b, c) {
Ok(V::boo(as_bool(b)? || as_bool(c)?))
});
fun!(if_(b, c) {
let b = as_bool(b)?;
let c = as_bool(c)?;
if b {... |
pub type IDontSupportEventSubscription = *mut ::core::ffi::c_void;
pub type IEnumEventObject = *mut ::core::ffi::c_void;
pub type IEventClass = *mut ::core::ffi::c_void;
pub type IEventClass2 = *mut ::core::ffi::c_void;
pub type IEventControl = *mut ::core::ffi::c_void;
pub type IEventObjectChange = *mut ::core::ffi::c... |
use chrono::{DateTime, Utc};
use diesel::{self, ExpressionMethods, PgConnection, QueryDsl, RunQueryDsl};
use serde::{Deserialize, Serialize};
use errors::Error;
use crate::models::Game;
use crate::schema::rounds::{self, table};
#[derive(Associations, Debug, Deserialize, Identifiable, Serialize, Queryable)]
#[belongs... |
//! Networking primitives for asynchronous TCP/UDP communication.
//!
//! This module provides networking functionality for the Transmission Control and User
//! Datagram Protocols, as well as types for IP and socket addresses.
//!
//! # Organization
//!
//! * [`TcpListener`] and [`TcpStream`] provide functionality for... |
use std::fmt::Debug;
use std::marker::PhantomData;
use std::marker::Send;
use super::facts::{self, Mapping};
pub trait PendingRequests {
fn get_pending(&self, id: u32) -> Option<&'static str>;
}
pub trait Atom<M>: facts::Factual<M> + Debug + Sized + Send + 'static
where
M: Mapping,
{
fn method(&self) -> ... |
use std::io::Read;
fn main() {
let mut buf = String::new();
// 標準入力から全部bufに読み込む
std::io::stdin().read_to_string(&mut buf).unwrap();
let mut iter = buf.split_whitespace();
let N: u8 = iter.next().unwrap().parse().unwrap();
let mut numbers: Vec<u8> = (0..N)
.map(|_| iter.next().unwrap().... |
#![deny(warnings)]
use log;
use pretty_env_logger;
use serde::{Deserialize, Serialize};
use warp::Filter;
#[derive(Deserialize, Serialize)]
struct Person {
name: String,
email: String,
age: u32,
}
#[tokio::main]
async fn main() {
pretty_env_logger::init();
// Used to check it the server is runn... |
//! Contains the [RpcFelt] and [RpcFelt251] wrappers around [Felt](stark_hash::Felt) which
//! implement RPC compliant serialization.
//!
//! The wrappers implement [serde_with::SerializeAs] which allows annotating
//! struct fields `serde_as(as = "RpcFelt")`to use the RPC compliant serialization.
//! It also allows sp... |
pub mod okta;
use anyhow::{anyhow, Result};
use std::str::FromStr;
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub enum ProviderType {
#[serde(alias = "okta", alias = "OKTA")]
Okta,
}
pub struct ProviderSession<T> {
session: T,
}
pub trait Provider<T, U, C> {
fn new_session(&self, pro... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[cfg(feature = "ApplicationModel_SocialInfo_Provider")]
pub mod Provider;
#[link(name = "windows")]
extern "system" {}
pub type SocialFeedChildItem = *mut ::core::ffi::c_void;
pub type SocialFeedContent =... |
#[derive(Eq, PartialEq, Debug)]
struct Rectangle {
width: usize,
height: usize,
x: usize,
y: usize,
id: String,
}
fn main() {
const INPUT: &str = include_str!("../input.txt");
let claims: Vec<Rectangle> = INPUT.lines().map(|claim| build_rectangle(claim)).collect();
let mut grid: Vec<Vec... |
extern crate iron;
extern crate router;
extern crate pug;
use iron::prelude::*;
use iron::mime::Mime;
use iron::status;
use pug::parse;
use router::Router;
use rustc_serialize::json;
use std::io::Read;
#[derive(RustcDecodable)]
struct Data {
template: String
}
fn health(_: &mut Request) -> IronResult<Respon... |
use crate::{DocBase, VarType};
const DESCRIPTION: &'static str = r#"
Renders a horizontal line at a given fixed price level.
"#;
const EXAMPLES: &'static str = r#"
```pine
hline(3.14, title='Pi', color=color.blue, linestyle=hline.style_dotted, linewidth=2)
// You may fill the background between any two hlines with a... |
use crate::rewards::VoterApy;
use anyhow::Context;
use serde::{Deserialize, Serialize};
use solana_sdk::clock::Epoch;
use solana_sdk::pubkey::Pubkey;
use solana_transaction_status::{Reward, Rewards};
use std::collections::HashMap;
pub type PubkeyVoterApyMapping = HashMap<Pubkey, (Pubkey, f64)>;
pub const EPOCH_REWARD... |
use wgpu::util::DeviceExt;
use crate::{
wgpu_state::WgpuState,
mesh::Pipeline,
static_data::MeshData,
asset::{Handle, Assets},
texture::Texture,
};
#[repr(C)]
#[derive(Copy, Clone, Debug, bytemuck::Pod, bytemuck::Zeroable)]
pub struct Vertex {
position: [f32; 3],
tex_coords: [f32; 2],
}
im... |
// 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 ... |
use crate::collections::FnCache;
use fn_search_backend_db::models::Function;
use std::collections::HashSet;
#[test]
fn build_cache_for_fn_ref() {
let v: Vec<&Function> = Vec::new();
let _: FnCache = v.into_iter().collect();
}
#[test]
fn build_cache_for_fn() {
let v: Vec<Function> = Vec::new();
let _: ... |
extern crate llvm_sys as llvm;
extern crate libc;
use std::ptr;
use std::ffi;
use std::borrow::Cow;
use self::llvm::prelude::{LLVMContextRef, LLVMModuleRef, LLVMBuilderRef, LLVMValueRef, LLVMTypeRef};
use self::llvm::core::*;
use self::llvm::target::*;
use self::llvm::target_machine::*;
use std::collections::{HashMap... |
//! A crate to enable easy use of the [precedence climbing][1] algorithm.
//! You plug your own handler function, token struct, and operator enum,
//! and this crate provides the algorithm.
//!
//! Because the crate is sufficiently generic, It's possible to add
//! very complex behavior without having to roll your own ... |
/// Route handlers for the /api/articles APIs
pub mod articles;
/// Models for objects returned by the web API
///
/// See the [API Spec](https://github.com/gothinkster/realworld/tree/master/api#json-objects-returned-by-api)
/// for more information.
pub mod model;
/// Route handlers for the /profiles API
pub mod pro... |
use input_i_scanner::InputIScanner;
fn main() {
let stdin = std::io::stdin();
let mut _i_i = InputIScanner::from(stdin.lock());
macro_rules! scan {
(($($t: ty),+)) => {
($(scan!($t)),+)
};
($t: ty) => {
_i_i.scan::<$t>() as $t
};
(($($t: ty),... |
extern crate file;
extern crate tempdir;
extern crate duplicate_kriller;
use std::fs;
use tempdir::TempDir;
use duplicate_kriller::*;
#[test]
fn hardlink_of_same_file() {
let dir = TempDir::new("hardlinktest").unwrap();
let a_path = dir.path().join("a");
let b_path = dir.path().join("b");
file::put_... |
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn serialize_operation_batch_execute_statement(
input: &crate::input::BatchExecuteStatementInput,
) -> Result<smithy_http::body::SdkBody, smithy_types::Error> {
let mut out = String::new();
let mut object = smithy_json::ser... |
// 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 std::fmt::{Debug, Formatter};
use std::fmt::Result as FmtResult;
use super::KeyEvent;
/// An action performed by the key binding.
/// Contains the event that is performed (e.g what Lua or Rust function
/// to call), and meta data around the action such as whether to include
/// passthrough to the client or not.
#[... |
#[doc = "Reader of register DINR31"]
pub type R = crate::R<u32, super::DINR31>;
#[doc = "Reader of field `DIN31`"]
pub type DIN31_R = crate::R<u16, u16>;
impl R {
#[doc = "Bits 0:15 - Input data received from MDIO Master during write frames"]
#[inline(always)]
pub fn din31(&self) -> DIN31_R {
DIN31_... |
use crate::*;
use num_derive::FromPrimitive;
use num_traits::FromPrimitive;
use wasmer_runtime::{Array, Ctx, WasmPtr};
/// The log levels used by CommonWA. See the log namespace documentation for
/// more information.
#[repr(u32)]
#[derive(Debug, FromPrimitive)]
pub enum LogLevel {
Error = 1,
Warning = 3,
... |
//! Fetch and apply operations to the current value, returning the previous value.
use core::sync::atomic::Ordering;
/// Bitwise "and" with the current value.
pub trait And {
/// The underlying type
type Type;
/// Bitwise "and" with the current value.
///
/// Performs a bitwise "and" operation on ... |
extern crate httparse;
extern crate olin;
use log::{error, info};
use olin::{http, Resource};
use std::io::{Read, Write};
pub extern "C" fn test() -> Result<(), i32> {
info!("running scheme::http tests");
let reqd = "GET /404 HTTP/1.1\r\nHost: xena.greedo.xeserv.us\r\nUser-Agent: Bit-banging it in rust\r\n\r... |
#![allow(dead_code, unused_variables)]
use ast;
use types::{Ty, ValueEnv, TypeEnv, EnvEntry};
use symbol::SymbolTable;
use std::cell::RefCell;
type AstTy = ast::Ty;
type AstEx = ast::Exp;
type Exp = ();
#[derive(Debug)]
pub struct ExpTy {
exp: Exp,
// this should be Rc<Ty>
ty: Ty,
}
struct UniqueGener... |
use piston_window::G2d;
use std::collections::HashMap;
use graphics::Transformed;
use graphics::math::{ Scalar, Vec2d, Matrix2d };
use std::f64::consts::PI;
use super::chunk::Chunk;
use util::graphics::Image;
use game::camera::Camera;
use game::player::{ self, Player };
use game::*;
use game::operation::*;
pub const ... |
#[cfg(feature = "redis-backend")]
use redis::{ErrorKind, FromRedisValue, RedisResult, ToRedisArgs, Value as RedisValue};
use ring::{digest, pbkdf2};
#[cfg(feature = "dynamo-backend")]
use rusoto_dynamodb::AttributeValue;
#[cfg(feature = "redis-backend")]
use serde_json;
#[cfg(feature = "dynamo-backend")]
use std::coll... |
// 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 ... |
pub use amcl::nist256 as curve;
#[derive(Serialize, Deserialize)]
pub struct ClientRequestWrapper {
pub bl_sig_req: String,
pub host: String,
pub http: String,
}
#[derive(Serialize, Deserialize)]
pub struct ClientRequest {
#[serde(rename = "type")]
pub type_f: String,
pub contents: Vec<String>,
}
|
use crate::utils;
pub fn run(problem: &i32, input: &str) {
match problem {
1 => {
problem1(input);
}
2 => {
problem2(input);
}
_ => {
panic!("Unknown problem: {}", problem);
}
};
}
fn problem1(input: &str) {
let mut count:... |
use crate::solver::*;
use crate::graph::Incidence;
use itertools::Itertools;
impl Solve for Incidence {
fn solve(self, td: Decomposition, k: usize, formula: Formula) -> Option<(Assignment, usize)> {
let nice_td = make_nice(&self, td, true);
let tree_index = tree_index(&nice_td, k, self.size());
let tr... |
use std::collections::HashMap;
use std::net::SocketAddr;
use std::sync::Arc;
use tokio::sync::{Mutex, MutexGuard};
use crate::protobuf::raft_rpc_client::RaftRpcClient;
use crate::protobuf::{AppendEntriesRequest, AppendEntriesResponse, VoteRequest, VoteResponse};
use crate::raft::NodeId;
use crate::raft::Result;
pub ... |
/*
* Kinds are types of type.
*
* Every type has a kind. Every type parameter has a set of kind-capabilities
* saying which kind of type may be passed as the parameter.
*
* The kinds are based on two capabilities: move and send. These may each be
* present or absent, though only three of the four combinations can actua... |
// 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 ... |
mod cli;
mod command;
mod config;
mod download;
fn main() {
cli::cli();
}
|
use crate::utils::{assert_eq_with_gas, assert_one_promise_error, init_user_contract, KeySet};
use near_sdk::json_types::U128;
use near_sdk_sim::{call, to_yocto};
#[test]
fn create_near_campaign_incorrect_name() {
let initial_balance = to_yocto("100");
let transfer_amount = to_yocto("50");
let tokens_per_key = to... |
//! Iron handlers
/// Process requests from the Rocket.Chat server
mod rocketchat;
/// Process login request for Rocket.Chat
mod rocketchat_login;
/// Processes requests from the Matrix homeserver
mod transactions;
/// Sends a welcome message to the caller
mod welcome;
pub use self::rocketchat::Rocketchat;
pub use se... |
extern crate time;
/// An incomplete implementation of `HTTP/1.1`.
pub mod http;
|
use crate::{FunctionCtx, Backend};
use crate::ptr::Pointer;
use crate::place::Place;
use lowlang_syntax as syntax;
use syntax::layout::TyLayout;
use cranelift_codegen::ir::{self, InstBuilder};
#[derive(Clone, Copy)]
pub struct Value<'t, 'l> {
pub kind: ValueKind,
pub layout: TyLayout<'t, 'l>,
}
#[derive(Clone... |
fn main() {
let input = include_str!("input.txt");
let mut total = 0;
for line in input.lines() {
let mass: i32 = line.parse().unwrap();
total += mass / 3 - 2;
}
println!("Part 1: {}", total);
let mut part2 = 0;
for line in input.lines() {
let mass: i32 = line.pa... |
use crate::{hlist, Cons, Extend, Nil};
/// Reverse hlist.
///
/// ## Examples
///
/// ```
/// use minihlist::{hlist, Rev};
///
/// let list = hlist![1, "h", 'x'];
/// assert_eq!(list.rev(), hlist!['x', "h", 1])
/// ```
pub trait Rev {
type Output;
fn rev(self) -> Self::Output;
}
impl Rev for Nil {
type O... |
#[global_allocator]
static ALLOCATOR: jemallocator::Jemalloc = jemallocator::Jemalloc;
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate log;
use std::collections::{HashSet, VecDeque};
use std::fs::File;
use std::io::{BufRead, BufReader, Read};
use std::time::{Duration, Instant};
use timely::dataflow... |
mod base;
mod revision_0031;
mod revision_0032;
mod revision_0033;
mod revision_0034;
mod revision_0035;
mod revision_0036;
mod revision_0037;
mod revision_0038;
mod revision_0039;
pub(crate) use base::base_schema;
type MigrationFn = fn(&rusqlite::Transaction<'_>) -> anyhow::Result<()>;
/// The full list of pathfin... |
use libc;
use std::mem;
use std::slice;
use super::{PirQuery, PirReply};
extern "C" {
fn new_parameters(ele_num: u32, ele_size: u32, N: u32, logt: u32, d: u32) -> *mut libc::c_void;
fn update_parameters(params: *mut libc::c_void, ele_num: u32, ele_size: u32, d: u32);
fn delete_parameters(params: *mut libc... |
// 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 crate::{compiler, scope::Scope, PyResult, VirtualMachine};
pub fn eval(vm: &VirtualMachine, source: &str, scope: Scope, source_path: &str) -> PyResult {
match vm.compile(source, compiler::Mode::Eval, source_path.to_owned()) {
Ok(bytecode) => {
debug!("Code object: {:?}", bytecode);
... |
// auto generated, do not modify.
// created: Mon Feb 22 23:57:02 2016
// src-file: /QtWidgets/qlayout.h
// dst-file: /src/widgets/qlayout.rs
//
// header block begin =>
#![feature(libc)]
#![feature(core)]
#![feature(collections)]
extern crate libc;
use self::libc::*;
// <= header block end
// main block begin =>
/... |
//==============================================================================
// Notes
//==============================================================================
// drivers::lcd::font.rs
// Minimal and Large Numeric Font
//
// Minimal Characters:
// Minimal characters are to be used most places. They can be e... |
#![feature(slice_concat_ext)]
extern crate ramp;
extern crate bufstream;
extern crate regex;
use std::sync::mpsc::channel;
use std::thread;
use std::sync::{RwLock, Arc};
use std::net::{TcpListener, TcpStream};
use std::io::{Read, BufRead, Write};
use regex::Regex;
use std::slice::SliceConcatExt;
#[macro_use]
extern c... |
use super::android::{back, draw, get_ime, input, set_ime, sleep, swipe, tap, Xpath};
use super::config::Rules;
use rand::Rng;
use serde::Deserialize;
#[derive(Debug, Deserialize, Clone)]
struct Comment {
tags: Vec<String>,
content: Vec<String>,
}
fn get_comment(name: &str) -> String {
lazy_static! {
... |
#![windows_subsystem = "windows"]
/*
Note: to statically link vcruntime, add the following to ~/.cargo/config
[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "target-feature=+crt-static"]
*/
use std::{mem::transmute, ptr, ffi::CString};
#[link(name="kernel32")]
extern {
pub fn LoadLibraryA(lpLibFileName: *const... |
struct GPoint {
x: f32, y: f32
}
pub struct Canvas {
filename: String
}
impl Canvas {
pub fn new(filename: String) -> Canvas {
Canvas { filename: filename }
}
pub fn clear() {
}
pub fn filename(self) -> String {
self.filename
}
}
|
use diesel::prelude::*;
use crate::models::Rustacean;
use crate::schema::rustaceans;
pub struct RustaceanRepository;
impl RustaceanRepository {
pub fn load_all(c: &SqliteConnection) -> QueryResult<Vec<Rustacean>> {
rustaceans::table.limit(100).load::<Rustacean>(c)
}
pub fn find_by_id(c: &SqliteC... |
// 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 ... |
//! Bindings to [mpg123][1].
//!
//! [1]: https://www.mpg123.de/
#![allow(non_camel_case_types)]
#[macro_use]
extern crate bitflags;
extern crate libc;
use libc::{c_char, c_double, c_int, c_long, c_uchar, c_ulong, c_void, off_t, size_t, ssize_t};
#[derive(Clone, Copy)]
#[repr(C)]
pub enum mpg123_channelcount {
... |
//! Wraps a child operator, and mediates the communication of progress information.
use std::default::Default;
use progress::frontier::{MutableAntichain, Antichain};
use progress::{Timestamp, Operate};
use progress::nested::Target;
use progress::nested::subgraph::Target::{GraphOutput, ChildInput};
use progress::count... |
#[doc = "Reader of register HWCFGR1"]
pub type R = crate::R<u32, super::HWCFGR1>;
#[doc = "Writer for register HWCFGR1"]
pub type W = crate::W<u32, super::HWCFGR1>;
#[doc = "Register HWCFGR1 `reset()`'s with value 0x0302_0100"]
impl crate::ResetValue for super::HWCFGR1 {
type Type = u32;
#[inline(always)]
f... |
use super::header;
use super::question;
pub struct Message {
pub header: header::Header,
pub qd: Vec<question::Question>,
}
impl std::fmt::Display for Message {
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
println!("-------");
for i in &self.qd {
writeln!(... |
extern crate analytics_proto as ap;
extern crate chrono;
use ap::*;
use chrono::UTC;
fn main() {
extern crate serde_json;
fn make_event(message: Message) -> Event {
Event {
received_time: UTC::now(),
serviced_time: UTC::now(),
success: true,
message: me... |
use anyhow::Result;
use bytes::Bytes;
use futures::future;
use crate::core::Filesystem;
use crate::util::Node;
pub struct FilesystemChain {
systems: Vec<Box<dyn Filesystem>>,
}
impl FilesystemChain {
pub fn new(systems: Vec<Box<dyn Filesystem>>) -> Self {
Self { systems }
}
pub async fn dele... |
// 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 ... |
#[cfg(feature = "datastore")]
mod datastore;
#[cfg(feature = "pubsub")]
mod pubsub;
#[cfg(feature = "storage")]
mod storage;
#[cfg(feature = "vision")]
mod vision;
|
// 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 {
failure::Error,
fidl_fuchsia_cobalt::{
self as cobalt, CobaltEvent, LoggerFactoryRequest::CreateLoggerFromProjectName,
},
fid... |
use std::io::Read;
fn read<T: std::str::FromStr>() -> T {
let token: String = std::io::stdin()
.bytes()
.map(|c| c.ok().unwrap() as char)
.skip_while(|c| c.is_whitespace())
.take_while(|c| !c.is_whitespace())
.collect();
token.parse().ok().unwrap()
}
fn main() {
let... |
// 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 structopt::StructOpt;
#[derive(StructOpt, Clone, Debug)]
/// Simple integration test verifing basic AP WiFi functionality:
/// list interfaces, get st... |
/** client connection sequence **/
mod sub_sm;
use crate::{
message::{AuthType, ChannelName, NowCapset, NowChannelDef, NowMessage},
sm::{
ConnectionSM, ConnectionSMResult, ConnectionSMSharedData, ConnectionSMSharedDataRc, ConnectionSeqCallbackTrait,
ConnectionState, DummyConnectionSM,
},
};... |
/// Raw storage for the points that make up a glyph contour
use std::collections::{HashMap, HashSet};
use std::ops::Range;
use std::sync::Arc;
use super::design_space::{DPoint, DVec2};
use super::point::{EntityId, PathPoint};
use super::selection::Selection;
use druid::kurbo::{Affine, CubicBez, Line, ParamCurve, Path... |
use std::{
env,
fs::File,
io::{prelude::*, Error, ErrorKind, BufReader},
path::Path
};
fn modules_from_file(filename: impl AsRef<Path>) -> Result<Vec<i32>, Error> {
let input_file = File::open(filename).expect("[-] Error: could not read file.");
let reader = BufReader::new(input_file);
le... |
#[doc = "Reader of register ACRIS"]
pub type R = crate::R<u32, super::ACRIS>;
#[doc = "Reader of field `IN0`"]
pub type IN0_R = crate::R<bool, bool>;
#[doc = "Reader of field `IN1`"]
pub type IN1_R = crate::R<bool, bool>;
#[doc = "Reader of field `IN2`"]
pub type IN2_R = crate::R<bool, bool>;
impl R {
#[doc = "Bit ... |
use std::path::Path;
use std::io;
pub struct Buffer {
content: Vec<String>,
terminator: &'static str,
}
pub const UNIX_TERMINATOR: &'static str = "\n";
pub const DOS_TERMINATOR: &'static str = "\r\n";
#[cfg(windows)]
pub const DEFAULT_TERMINATOR: &'static str = DOS_TERMINATOR;
#[cfg(not(windows))]
pub const ... |
//! Decoding and Encoding of TIFF Images
//!
//! TIFF (Tagged Image File Format) is a versatile image format that supports
//! lossless and lossy compression.
//!
//! # Related Links
//! * <http://partners.adobe.com/public/developer/tiff/index.html> - The TIFF specification
extern crate tiff;
use color::ColorType;
us... |
pub mod alu;
pub mod arithmetic;
pub mod cpu;
pub mod dff;
pub mod keyboard;
pub mod logic;
pub mod pc;
pub mod ram;
pub mod register;
pub mod rom;
pub mod screen;
|
use std::ptr;
use winapi::shared::windef::HWND;
use winapi::shared::minwindef::DWORD;
use crate::ControlHandle;
use std::ffi::OsString;
pub const CUSTOM_ID_BEGIN: u32 = 10000;
pub fn check_hwnd(handle: &ControlHandle, not_bound: &str, bad_handle: &str) -> HWND {
use winapi::um::winuser::IsWindow;
if handle.... |
//! The json deserializable types
use super::{types::TransactionSimulation, CallFailure, SubprocessError};
use crate::v02::types::reply::FeeEstimate;
use pathfinder_common::CallResultValue;
/// The python loop currently responds with these four possibilities. An enum would be more
/// appropriate.
///
/// This is [`C... |
// Copyright (c) 2018-2022 Ministerio de Fomento
// Instituto de Ciencias de la Construcción Eduardo Torroja (IETcc-CSIC)
// 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 ... |
use super::field::Field;
pub trait Ec<F: Field> {
fn add(&self, p: Point<F>, q: Point<F>) -> Option<Point<F>>;
fn neg(&self, p: Point<F>) -> Option<Point<F>>;
fn mul(&self, n: isize, p: Point<F>) -> Option<Point<F>>;
}
#[derive(PartialEq, Clone, Eq, Debug)]
pub enum Point<F: Field> {
Identity,
Ord... |
extern crate image;
extern crate glob;
use glob::glob;
use serde::{Serialize, Deserialize};
use std::fs::File;
use std::io::Read;
use std::error::Error;
// Note all textures are 1-indexed since 0 is special
#[derive(Serialize, Debug)]
pub struct MapCell {
pub wall_tex: i32,
pub floor_tex: i32,
... |
use failure::Error;
fn main() -> Result<(), Error> {
println!("Hello, world!");
let txs = errors::get_txs("test_data/transactions.json").expect("Could not load transactions");
for t in txs {
println!("{:?}", t);
}
match errors::get_first_tx("test_data/transactions.json", "Rave") {
... |
/*
* Open Service Cloud API
*
* Open Service Cloud API to manage different backend cloud services.
*
* The version of the OpenAPI document: 0.0.3
* Contact: wanghui71leon@gmail.com
* Generated by: https://openapi-generator.tech
*/
#[derive(Debug, PartialEq, Serialize, Deserialize)]
pub struct BlockVolumeResour... |
//! Rust code which is called from lua in the init file
#![deny(dead_code)]
use rustc_serialize::json::ToJson;
use uuid::Uuid;
use super::{send, LuaQuery, running};
use hlua::{self, Lua, LuaTable};
use hlua::any::AnyLuaValue;
use registry::{self};
use commands;
use keys::{self, KeyPress, KeyEvent};
use convert::json:... |
use arduino_uno::prelude::*;
use arduino_uno::hal::port::{Pin, mode::Output};
use super::DotScreen;
/// The address of the register on the DotDisplay chip.
#[derive(Clone, Copy)]
#[repr(u8)]
enum RegisterAddress {
Column1 = 0x1,
Column2 = 0x2,
Column3 = 0x3,
Column4 = 0x4,
Column5 = 0x5,
Colum... |
#![feature(duration)]
extern crate ansi_term;
extern crate getopts;
#[macro_use]
extern crate lazy_static;
extern crate zookeeper;
use std::env;
use getopts::Options;
mod shell;
use shell::Shell;
fn usage(program: &str, opts: Options) {
let brief = format!("Usage: {} [options]", program);
print!("{}", op... |
use std::io::{self, BufReader, BufWriter};
use std::io::prelude::*;
use std::fs::{self, OpenOptions};
use std::path::Path;
fn conerror() -> ! {
panic!("fail to run");
}
fn file_breif(file_name: &Path) {
let meta_file = fs::metadata(file_name).unwrap();
let fs = match OpenOptions::new().read(true).open(file_... |
use crate::prelude::*;
#[repr(C)]
#[derive(Debug)]
pub struct VkDisplayPlanePropertiesKHR {
pub currentDisplay: VkDisplayKHR,
pub currentStackIndex: u32,
}
|
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct CoreDragDropManager(pub ::windows::core::IInsp... |
/*
* @lc app=leetcode.cn id=31 lang=rust
*
* [31] 下一个排列
*
* https://leetcode-cn.com/problems/next-permutation/description/
*
* algorithms
* Medium (29.96%)
* Total Accepted: 8.9K
* Total Submissions: 29.7K
* Testcase Example: '[1,2,3]'
*
* 实现获取下一个排列的函数,算法需要将给定数字序列重新排列成字典序中下一个更大的排列。
*
* 如果不存在下一个更大的排列,... |
pub(crate) use pwd::make_module;
#[pymodule]
mod pwd {
use crate::{
builtins::{PyIntRef, PyStrRef},
convert::{IntoPyException, ToPyObject},
exceptions,
types::PyStructSequence,
PyObjectRef, PyResult, VirtualMachine,
};
use nix::unistd::{self, User};
use std::ptr:... |
use anyhow::{bail, Context};
use argh::FromArgs;
use heck::CamelCase;
use quill_plugin_format::{PluginFile, PluginMetadata};
use std::{
fs,
path::PathBuf,
process::{Command, Stdio},
};
const TARGET_FEATURES: &str = "target-feature=+bulk-memory,+mutable-globals,+simd128";
const TARGET: &str = "wasm32-wasi";... |
use aries::planning::classical::search::*;
use aries::planning::classical::{from_chronicles, grounded_problem};
use aries::planning::parsing::pddl_to_chronicles;
//ajout pour initialisation de l'historique
use aries::planning::classical::state::*;
//ajout pour gerer fichier
use std::fs::File;
use std::io::{Write, Buf... |
use std::{env, fs, process};
use std::error::Error;
use std::net::Shutdown::Read;
use minigrep::Config;
fn main() {
let config = Config::new(env::args()).unwrap_or_else(|err| {
eprintln!("Problem parsing arguments: {}", err);
process::exit(1);
});
if let Err(e) = minigrep::run(config) {
... |
use crate::config::Config;
use log::LevelFilter;
use simple_logging;
mod config;
mod datastructure;
mod postprocessors;
mod raytracer;
mod renderer;
mod scene;
mod generator;
mod shader;
mod util;
fn main() {
simple_logging::log_to_stderr(LevelFilter::Debug);
// Config::default().dump("config.yml")
// ... |
use std::io;
use std::os::unix::io::RawFd;
use std::pin::Pin;
use std::task::{Context, Poll};
use futures_core::ready;
use crate::completion::Completion;
use crate::drive::Completion as ExternalCompletion;
use crate::drive::Drive;
use crate::event::Cancellation;
use State::*;
pub struct Engine<Ops, D: Drive> {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.