text stringlengths 8 4.13M |
|---|
use mysql::Pool;
use std::env;
pub fn get_pool() -> Pool {
let mut builder = mysql::OptsBuilder::new();
let _dotenv = dotenv::dotenv();
builder
.ip_or_hostname(Some(env::var("DB_HOST").unwrap()))
.db_name(Some(env::var("DB_DATABASE").unwrap()))
.user(Some(env::var("DB_USER").unwrap... |
use thiserror::Error;
#[derive(Clone, Debug, Error, PartialEq, Eq)]
pub enum ReconcileError {
#[error("Reconciliation failed with a permanent error: {0}")]
Permanent(String),
#[error("Reconciliation failed with a temporary error: {0}")]
Temporary(String),
}
impl ReconcileError {
pub fn permanent<S... |
#[macro_use] extern crate enum_primitive;
extern crate getopts;
extern crate num;
extern crate rand;
use getopts::Options;
use num::FromPrimitive;
use rand::{thread_rng, Rng};
use std::env;
use std::iter;
enum_from_primitive! {
enum Color {
Black = 30,
Red = 31,
Green = 32,
Yellow ... |
// Copyright 2018-2019 Mozilla
//
// 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, sof... |
#![cfg_attr(not(feature = "std"), no_std)]
#![feature(generic_associated_types)]
#![feature(const_fn_trait_bound)]
#![feature(const_fn_fn_ptr_basics)]
#![feature(const_option)]
#![allow(incomplete_features)]
#![feature(min_type_alias_impl_trait)]
#![feature(impl_trait_in_bindings)]
#![feature(type_alias_impl_trait)]
/... |
use specs::prelude::*;
#[derive(Component, Debug, Clone, PartialEq)]
pub struct Name {
pub string: String,
}
impl Name {
pub fn new(s: &str) -> Self {
Self { string: s.to_string() }
}
}
|
struct RConstraintsWidget {
left: ConstraintMember,
top: ConstraintMember,
width: ConstraintMember,
height: ConstraintMember,
right: Constant,
bottom: Constant,
h_center: Constant,
v_center: Constant,
hug_width: StrengthPolicy,
hug_height: StrengthPolicy,
resist_height: StrengthPolicy,
resist_width: Str... |
#[derive(Debug)]
struct Color(u32, u32, u32); //RGB
fn main() {
let black = Color(0, 0, 0);
let white = Color(255, 255, 255);
let mut custome_color = Color(187,62, 184);
custome_color.1 = custome_color.1 + 10; //72
println!("El color es: {:?}", black);
println!("El color es: {:?}", white);
... |
#[doc = "Reader of register CONN_TXMEM_BASE_ADDR_DLE"]
pub type R = crate::R<u32, super::CONN_TXMEM_BASE_ADDR_DLE>;
#[doc = "Writer for register CONN_TXMEM_BASE_ADDR_DLE"]
pub type W = crate::W<u32, super::CONN_TXMEM_BASE_ADDR_DLE>;
#[doc = "Register CONN_TXMEM_BASE_ADDR_DLE `reset()`'s with value 0"]
impl crate::Reset... |
// FORK NOTE: Copied from liballoc_system, removed unnecessary APIs,
// APIs take size/align directly instead of Layout
// The minimum alignment guaranteed by the architecture. This value is used to
// add fast paths for low alignment values. In practice, the alignment is a
// constant at the call site and the branch ... |
//! Tests auto-converted from "sass-spec/spec/css"
#[allow(unused)]
use super::rsass;
// From "sass-spec/spec/css/blockless_directive_without_semicolon.hrx"
#[test]
fn blockless_directive_without_semicolon() {
assert_eq!(
rsass(
"@foo \"bar\";\
\n"
)
.unwrap(),
... |
use std::collections::HashSet;
pub fn sum_of_multiples(limit: u32, factors: &[u32]) -> u32 {
let mut multiples = HashSet::new();
for factor in factors {
let mut multiple = *factor;
if multiple == 0 {
continue;
}
while multiple < limit {
multiples.insert(... |
// `map()` was described as a chainable way to simplify `match` statements.
// However, using `map()` on a function that returns an `Option<T>` results
// in the nested `Option<Option<T>>`. Chaining multiple calls together can
// then become confusing. That's where anothe combinator called `and_then()`,
// known in so... |
use SafeWrapper;
use target::FileType;
use support::OutputStream;
use pass;
use sys;
/// An LLVM target machine.
pub struct Machine(sys::TargetMachineRef);
impl Machine
{
pub fn add_passes_to_emit_file(&self,
pass_manager: &pass::Manager,
stre... |
//! A runtime implementation that runs everything on the current thread.
//!
//! [`current_thread::Runtime`][rt] is similar to the primary
//! [`Runtime`][concurrent-rt] except that it runs all components on the current
//! thread instead of using a thread pool. This means that it is able to spawn
//! futures that do n... |
//!Handles the elf symbols multiboot2 tag.
///Represents the elf symbols tag.
#[repr(C)]
struct ElfSymbols { //type = 9
tag_type: u32,
size: u32,
num: u16,
entsize: u16,
shndx: u16,
reserved: u16,
section_headers: u32 //this is just a placeholder, the headers start here
}
|
#[doc = "Register `TIM2_CCMR1_Input` reader"]
pub type R = crate::R<TIM2_CCMR1_INPUT_SPEC>;
#[doc = "Register `TIM2_CCMR1_Input` writer"]
pub type W = crate::W<TIM2_CCMR1_INPUT_SPEC>;
#[doc = "Field `CC1S` reader - Capture/Compare 1 selection This bit-field defines the direction of the channel (input/output) as well as... |
#[macro_use]
extern crate clap;
#[macro_use]
extern crate nom;
use clap::{App};
use std::{fmt, process};
use std::str::FromStr;
const DEFAULT_WIDTH: u8 = 10;
const DEFAULT_HEIGHT: u8 = 5;
#[derive(Debug)]
pub struct Color {
pub red: u8,
pub green: u8,
pub blue: u8,
}
impl fmt::Display for Color {
... |
use quote::{quote_spanned, ToTokens};
use syn::parse_quote;
use super::{
DelayType, FlowProperties, FlowPropertyVal, OperatorCategory, OperatorConstraints,
OperatorWriteOutput, Persistence, WriteContextArgs, RANGE_0, RANGE_1,
};
use crate::diagnostic::{Diagnostic, Level};
use crate::graph::{OpInstGenerics, Ope... |
use crate::base::id;
// https://developer.apple.com/documentation/appkit/nsstatusbar
#[derive(Clone, Copy, Debug)]
#[repr(C)]
pub struct NSStatusBar(id);
impl Default for NSStatusBar {
fn default() -> Self {
Self::system()
}
}
impl NSStatusBar {
pub fn system() -> Self {
Self(unsafe { msg_send!(class!(... |
#[doc = "Register `COMP5_CSR` reader"]
pub type R = crate::R<COMP5_CSR_SPEC>;
#[doc = "Register `COMP5_CSR` writer"]
pub type W = crate::W<COMP5_CSR_SPEC>;
#[doc = "Field `COMP5EN` reader - Comparator 5 enable"]
pub type COMP5EN_R = crate::BitReader;
#[doc = "Field `COMP5EN` writer - Comparator 5 enable"]
pub type COMP... |
use std::time::SystemTime;
/// Number of seconds in a minute.
pub const ONE_MINUTE: u32 = 60;
fn seconds_since(t: SystemTime) -> u64 {
SystemTime::now()
.duration_since(t)
.expect("time went backwards")
.as_secs()
}
/// All the possible phases that a pomodoro session might be in.
#[derive... |
fn main() {
let s: &str = "YELLOW SUBMARINE";
println!("Input: \"{}\"", s);
let s: &[u8] = s.as_bytes();
let mut s: Vec<u8> = s.to_vec();
pkcs7_pad(&mut s, 20);
let s: String = String::from_utf8(s).unwrap();
println!("Result: \"{}\"", s.escape_debug());
}
fn pkcs7_pad(buffer: &mut Vec<u8>, ... |
use mvg_lib::data::location;
use mvg_lib::data::MVGError;
use mvg_lib::MVG;
use mvg_lib::data::connection;
use clap::Clap;
use css_color_parser::Color as CssColor;
use lazy_static::lazy_static;
use termion::{color, style};
mod conf;
use conf::Config;
const STATION_NAME_MAX_CHARS: usize = 40;
lazy_static! {
stat... |
fn main() {
let mut pressed_chars: indexmap::IndexMap<char, u32> = indexmap::IndexMap::new();
ncurses::initscr();
ncurses::noecho();
ncurses::addstr("Counter by mssdvd\n");
loop {
for (char, times) in &pressed_chars {
ncurses::addstr(&format!(
"Char: `{}` press... |
pub mod errors;
//mod utils;
|
// 2019-01-02
// Un struct est un groupe de variable. Ici, des données utilisateur.
// Ici, on va construire un struct avec une fonction.
use std::io;
// Debug est un TRAIT. Solution tirée de stack overflow pour afficher le struct.
#[derive(Debug)]
// On définit le struct User EN DEHORS de la fonction main()
struct U... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Software clock gating enable register"]
pub sw_clkg_en: SW_CLKG_EN,
#[doc = "0x04 - Software clock mask register"]
pub sw_clk_mask: SW_CLK_MASK,
_reserved2: [u8; 4usize],
#[doc = "0x0c - Software reset control regis... |
extern crate cgmath;
#[macro_use]
extern crate clap;
extern crate collision;
extern crate futures;
extern crate grpcio;
extern crate point_viewer;
extern crate point_viewer_grpc;
extern crate protobuf;
use cgmath::Point3;
use collision::Aabb3;
use futures::{Stream, Future, Sink};
use futures::sync::oneshot;
use grpcio... |
pub mod calculable;
pub mod shapes; |
#[doc = "Register `SR` reader"]
pub type R = crate::R<SR_SPEC>;
#[doc = "Field `ALRAF` reader - Alarm A flag This flag is set by hardware when the time/date registers (RTC_TR and RTC_DR) match the alarm A register (RTC_ALRMAR)."]
pub type ALRAF_R = crate::BitReader;
#[doc = "Field `TSF` reader - Timestamp flag This fla... |
use crate::lattices::{BoundedPrefix, SealedSetOfIndexedValues};
use crate::structs::{LineItem, Request};
pub fn tuple_wrap<'a>(
it: impl 'a + Iterator<Item = Request>,
) -> impl 'a + Iterator<Item = (usize, LineItem)> {
it.scan(false, |checked_out, item| {
if *checked_out {
None
} e... |
#[derive(Debug, Clone)] // this is very useful for debugging
pub struct Coordinate {
pub x: i32,
pub y: i32,
}
|
mod qt_gui;
fn main () -> () {
let app = qt_gui::QApplication::new();
let label = qt_gui::QLabel::new();
label.resize(640, 480);
label.set_text("測試");
label.show();
app.exec();
}
|
use std::fmt::Display;
use std::fmt::Formatter;
use std::fmt::Result;
use smallstep::environment::Environment;
pub mod machine;
pub mod environment;
#[derive(Clone)]
pub enum Node {
Number(i64),
Add(Box<Node>, Box<Node>),
Multiply(Box<Node>, Box<Node>),
Boolean(bool),
LessThan(Box<Node>, Box<Node... |
use std::fmt;
use super::*;
#[cfg(windows)]
const LINE_ENDING: &'static str = "\r\n";
#[cfg(not(windows))]
const LINE_ENDING: &'static str = "\n";
impl Board {
pub fn parse(sudoku_content: String) -> Self {
let mut board = create_board();
board_parser::fill(&mut board, sudoku_content);
b... |
use byteorder::{LittleEndian, WriteBytesExt};
use failure::{format_err, Error};
use crate::model::{owned::OwnedBuf, TypeSpec};
#[derive(Debug)]
pub struct TableTypeSpecBuf {
id: u16,
flags: Vec<u32>,
}
impl TableTypeSpecBuf {
pub fn new(id: u16) -> Self {
Self {
id,
flags:... |
#[doc = "Reader of register PWR_TRIM_REF_CTL"]
pub type R = crate::R<u32, super::PWR_TRIM_REF_CTL>;
#[doc = "Writer for register PWR_TRIM_REF_CTL"]
pub type W = crate::W<u32, super::PWR_TRIM_REF_CTL>;
#[doc = "Register PWR_TRIM_REF_CTL `reset()`'s with value 0x70f0_0000"]
impl crate::ResetValue for super::PWR_TRIM_REF_... |
use std::cell::RefCell;
use std::rc::Rc;
use wayland_server::{
protocol::{wl_data_device_manager::DndAction, wl_data_offer, wl_data_source, wl_pointer, wl_surface},
NewResource,
};
use crate::wayland::{
compositor::{roles::Role, CompositorToken},
seat::{AxisFrame, PointerGrab, PointerInnerHandle, Seat... |
#[doc = "Register `AHB4LPENR` reader"]
pub type R = crate::R<AHB4LPENR_SPEC>;
#[doc = "Register `AHB4LPENR` writer"]
pub type W = crate::W<AHB4LPENR_SPEC>;
#[doc = "Field `SDMMC1LPEN` reader - SDMMC1 and SDMMC1 delay peripheral clock enable during sleep mode Set and reset by software"]
pub type SDMMC1LPEN_R = crate::Bi... |
struct Unit {
// Core
id: u32,
name: String,
title: String,
level: u32,
// Combat
hp_max: u32,
hp_cur: u32,
mana_max: u32,
mana_cur: u32,
dmg_base: u32,
}
impl Unit {
fn hit_target(&self, target: &mut Unit) {
target.take_damage(self.dmg_base);
}
fn take... |
use std::{env, fs};
use ngc::parse::parse;
use ngc::eval::{Evaluator, Axis};
fn main() {
let filename = env::args().nth(1).unwrap();
let input = fs::read_to_string(&filename).unwrap();
match parse(&filename, &input) {
Err(e) => eprintln!("Parse error: {}", e),
Ok(prog) => {
let ... |
use std::thread;
fn main() {
let mut x = 5;
let h = thread::spawn(|| {
x += 1;
});
h.join().unwrap();
println!("{}", x);
}
|
use itertools::Itertools;
use std::fs;
use std::ops::RangeInclusive;
type Position = (isize, isize);
type Velocity = (isize, isize);
type Area = (RangeInclusive<isize>, RangeInclusive<isize>);
type KineticState = (Position, Velocity);
fn within_area((x_range, y_range): &Area, (x, y): &Position) -> bool {
x_range.... |
/* This is part of mktcb - which is under the MIT License ********************/
// Traits ---------------------------------------------------------------------
use std::io::Write;
// ----------------------------------------------------------------------------
use std::path::PathBuf;
use std::process::{Command, Stdio}... |
use core::convert::{TryFrom, TryInto};
use alloc::vec::Vec;
use fermium::{
SDL_Event, SDL_EventType, SDL_AUDIODEVICEADDED, SDL_AUDIODEVICEREMOVED,
SDL_CONTROLLERAXISMOTION, SDL_CONTROLLERBUTTONDOWN, SDL_CONTROLLERBUTTONUP,
SDL_CONTROLLERDEVICEADDED, SDL_CONTROLLERDEVICEREMAPPED,
SDL_CONTROLLERDEVICEREMOVED, S... |
pub mod gdt;
pub mod idt;
pub mod tss;
pub mod stack;
|
/// Link is up (administratively).
pub const IFF_UP: u32 = libc::IFF_UP as u32;
/// Link is up and carrier is OK (RFC2863 OPER_UP)
pub const IFF_RUNNING: u32 = libc::IFF_RUNNING as u32;
/// Link layer is operational
pub const IFF_LOWER_UP: u32 = libc::IFF_LOWER_UP as u32;
/// Driver signals IFF_DORMANT
pub const IFF_DO... |
use std::collections::HashMap;
#[derive(Clone, Copy, Debug)]
pub enum ItemEnum {
Armor(Item),
Weapon(Item),
Ring(Item, Item),
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct Item {
damage: i64,
armor: i64,
pub cost: i64,
}
impl Item {
pub fn new(damage: i64, armor: i64, cost: i64) -... |
use libloading::Library;
use std::fs::ReadDir;
use types::Identifier;
/// Grabs all `Library` entries found within a given directory
pub(crate) struct LibraryIterator {
directory: ReadDir,
}
impl LibraryIterator {
pub(crate) fn new(directory: ReadDir) -> LibraryIterator { LibraryIterator { directory } }
}
im... |
use std::env;
struct Node {
value: usize,
next: usize,
}
fn main() {
let args: Vec<String> = env::args().collect();
let steps: usize = args[1].parse().unwrap();
let mut buffer = Vec::new();
buffer.reserve_exact(2018);
buffer.push(Node { value: 0, next: 0 });
let mut pos = 0usize;
... |
use crate::protocol::error::ProtocolError;
#[derive(Debug, Clone, Copy)]
pub enum Speed {
S0_5 = 1,
S1 = 2,
S1_5 = 3,
S2 = 4,
S2_5 = 5,
S3 = 6,
S3_5 = 7,
S4 = 8,
S4_5 = 9,
S5 = 10,
S5_5 = 11,
S6 = 12,
S6_5 = 13,
S7 = 14,
S7_5 = 15,
}
impl Default for Speed {... |
use std::{
sync::Arc,
time::{Duration, Instant},
};
use caolo_sim::executor::SimpleExecutor;
use tokio::sync::broadcast::Sender;
use tracing::{debug, info, warn};
use crate::{world_service, WorldContainer};
pub async fn game_loop(
world: WorldContainer,
mut executor: SimpleExecutor,
outpayload: A... |
// Copyright 2018 Mohammad Rezaei.
//
// 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 accordin... |
use futures::Future;
use futures::FutureExt;
use crate::base::{CommitId, ErrorCode};
use crate::client::PeerClient;
use crate::storage::local::error_helper::into_error_code;
use crate::storage::ROOT_INODE;
use futures::future::{err, join_all, Either};
use log::info;
use sha2::{Digest, Sha256};
use std::cmp::min;
use s... |
use {Error, Result};
use cameras::{CameraConfig, Config, image};
use iron::Request;
/// A serializable summary of a camera.
#[derive(Serialize, Debug)]
pub struct Summary {
/// The name of the camera.
pub name: String,
/// A description of the camera's location and its use.
pub description: String,
... |
//! Implements the most high-level API of `SVM`.
mod call;
mod config;
mod default;
mod failure;
mod function;
mod outcome;
pub use call::Call;
pub use failure::Failure;
pub use function::Function;
pub use outcome::Outcome;
#[cfg(feature = "default-rocksdb")]
mod rocksdb;
#[cfg(feature = "default-rocksdb")]
pub use... |
// src/evaluator/builtins.rs
use crate::evaluator::*;
use crate::object::*;
pub fn get_builtin(name: &str) -> Option<Object> {
match name {
"len" => {
let func: BuiltinFunction = |args| {
if args.len() != 1 {
return Err(format!(
"wron... |
use std::fmt::Display;
use crate::Token;
macro_rules! write_match {
($self:expr, $f:expr, $($pat:pat => {$format:literal$(, $($params:expr),*)?})*) => {
match $self{
$(
$pat => {
write!($f,$format $(, $($params),*)?)
}
)*
... |
//! An implementation of ArrayHash
//!
//! ArrayHash is a data structure where the index is determined by hash and
//! each entry in array is a `Vec` that store data and all it collision.
//!
//! Oritinal paper can be found [here](Askitis, N. & Zobel, J. (2005), Cache-conscious collision resolution for string hash ta... |
#[doc = "Register `ICSCR` reader"]
pub type R = crate::R<ICSCR_SPEC>;
#[doc = "Register `ICSCR` writer"]
pub type W = crate::W<ICSCR_SPEC>;
#[doc = "Field `HSI16CAL` reader - nternal high speed clock calibration"]
pub type HSI16CAL_R = crate::FieldReader;
#[doc = "Field `HSI16TRIM` reader - High speed internal clock tr... |
pub mod code_generator;
pub mod compiler;
pub mod constants;
pub mod map;
pub mod modules;
pub mod passes;
pub mod program;
|
use num::div_rem;
use int2dec::digits::{Digits64, Digits32};
use int2dec::digits::{NDIGITS64, NDIGITS32};
use int2dec::digits::{ONES, TENS};
// http://homepage.cs.uiowa.edu/~jones/bcd/decimal.html#sixtyfour
pub fn u64_to_digits(n: u64) -> Digits64 {
let mut buf: Digits64 = [0; NDIGITS64];
let n0 = (n & 0xfff... |
use std::convert::From;
use std::io::Read;
use lexer;
use super::readers::*;
use super::token::{Token, TokenKind};
pub struct Lexer {
lexer: lexer::Lexer<TokenKind>,
}
impl Lexer {
#[inline]
fn new(mut lexer: lexer::Lexer<TokenKind>) -> Self {
lexer.readers
.add(CommentReader)
... |
use super::*;
impl<'a> JIT<'a> {
pub fn compile_op_call(&mut self, ins: &Ins, call_link_info_idx: usize) {
let callee = match ins {
Ins::Call(callee, ..) => *callee,
_ => unimplemented!(),
};
/* Caller always:
- Updates BP to callee callFrame.
... |
use bytes::BytesMut;
use std::net::IpAddr;
use std::str::FromStr;
use http::uri::Authority;
/// A normalized `Authority`.
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
pub struct FullyQualifiedAuthority(Authority);
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
pub struct NamedAddress {
pub name: FullyQualifiedAut... |
//! IMPLEMENTATION DETAILS USED BY MACROS
use core::fmt::{self, Write};
use crate::hio::{self, HostStream};
static mut HSTDOUT: Option<HostStream> = None;
pub fn hstdout_str(s: &str) {
let _result = critical_section::with(|_| unsafe {
if HSTDOUT.is_none() {
HSTDOUT = Some(hio::hstdout()?);
... |
// Solution taken from a C++ solution found here: https://www.reddit.com/r/adventofcode/comments/7lte5z/2017_day_24_solutions/
use std::cmp::Ord;
use std::collections::HashMap;
use std::fs::File;
use std::io::Read;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
struct Component {
port1: u32,
port2: u32,
}
... |
extern crate s3;
use std::process::Command;
use self::s3::bucket::Bucket;
use self::s3::credentials::Credentials;
const BUCKET: &'static str = "horuscdn";
const REGION: &'static str = "eu-central-1";
/// Get the AWS credentials for the bucket
fn get_s3_creds() -> Credentials
{
Credentials::new(&::AWS_ACCESS, &:... |
/*
* Datadog API V1 Collection
*
* Collection of all Datadog Public endpoints.
*
* The version of the OpenAPI document: 1.0
* Contact: support@datadoghq.com
* Generated by: https://openapi-generator.tech
*/
/// UsageAttributionSort : The field to sort by.
/// The field to sort by.
#[derive(Clone, Copy, Debug,... |
// ===============================================================================
// Authors: AFRL/RQQA
// Organization: Air Force Research Laboratory, Aerospace Systems Directorate, Power and Control Division
//
// Copyright (c) 2017 Government of the United State of America, as represented by
// the Secretary of th... |
use std::io;
use String;
fn main() {
println!("Input \"exit\" to break the loop!");
loop {
let mut f_letter = FirstLetter {
letter: ' ',
read: false,
vowel: false,
};
let mut string = String::new();
io::stdin()
.read_line(&mut ... |
use Chirality::*;
use Shape::*;
#[derive(Clone, Copy, PartialEq)]
enum Chirality {
Left,
Right,
}
#[derive(Clone, Copy, PartialEq)]
enum Shape {
Round,
Square,
Curly,
}
struct Bracket(Chirality, Shape);
impl Bracket {
fn new(character: char) -> Option<Self> {
match character {
... |
pub mod renderer;
pub use renderer::Renderer;
|
#[lang="eh_personality"]
extern "C" fn eh_personality() {}
#[no_mangle]
#[allow(non_snake_case)]
pub extern "C" fn _Unwind_Resume(_ex_obj: *mut ()) { }
/// 64 bit remainder on 32 bit arch
#[no_mangle]
#[cfg(target_arch = "x86")]
pub extern "C" fn __umoddi3(mut a: u64, mut b: u64) -> u64 {
let mut hig = a >> 32; /... |
mod config;
pub mod highlighting;
mod theme;
pub use crate::config::{
languages::Language, link_checker::LinkChecker, markup::HighlighterSettings, slugify::Slugify,
taxonomies::Taxonomy, Config,
};
use std::path::Path;
/// Get and parse the config.
/// If it doesn't succeed, exit
pub fn get_config(filename: &... |
use spin::Mutex;
use generic_array::typenum::U32;
use generic_array::GenericArray;
use x25519_dalek::PublicKey;
use x25519_dalek::SharedSecret;
use x25519_dalek::StaticSecret;
use crate::device::Device;
use crate::timestamp;
use crate::types::*;
/* Represents the recomputation and state of a peer.
*
* This type i... |
use reqwest;
use scraper::Html;
pub async fn fetch(http_client: &reqwest::Client) -> Result<Html, Box<dyn std::error::Error>> {
// 웹개발전체, 응용프로그램개발전체, 시스템개발전체, 서버네트워크보안전체, 게임일부
// 정규직, 병역특례, 인턴직
const SARAMIN_URL: &str = concat!(
"https://www.saramin.co.kr/zf_user/jobs/list/job-category",
"?... |
// q0051_n_queens
struct Solution;
impl Solution {
pub fn solve_n_queens(n: i32) -> Vec<Vec<String>> {
if n == 0 {
return vec![vec![]];
}
let mut ret = vec![];
let mut map = vec![];
Solution::solve(n, &mut map, &mut ret);
// println!("answer: {:?}", ret)... |
#[doc = "Register `TIM5_CCMR3` reader"]
pub type R = crate::R<TIM5_CCMR3_SPEC>;
#[doc = "Register `TIM5_CCMR3` writer"]
pub type W = crate::W<TIM5_CCMR3_SPEC>;
#[doc = "Field `OC5FE` reader - OC5FE"]
pub type OC5FE_R = crate::BitReader;
#[doc = "Field `OC5FE` writer - OC5FE"]
pub type OC5FE_W<'a, REG, const O: u8> = cr... |
import str::sbuf;
export program;
export run_program;
export start_program;
export program_output;
export spawn_process;
export waitpid;
native "rust" mod rustrt {
fn rust_run_program(argv: *sbuf, in_fd: int, out_fd: int, err_fd: int) ->
int;
}
fn arg_vec(prog: str, args: [@str]) -> [sbuf] {
let argp... |
//! Trek - Fast, effective, minimalist web framework for Rust.
#![deny(unsafe_code)]
#![warn(
nonstandard_style,
rust_2018_idioms,
future_incompatible,
missing_debug_implementations
)]
#[macro_use]
extern crate log;
mod trek;
pub mod middleware;
#[doc(inline)]
pub use trek_core::{
box_dyn_handl... |
use std::convert::TryFrom;
use crate::protocol::Serializable;
use nia_protocol_rust::GetDefinedMappingsRequest;
use crate::error::NiaServerError;
use crate::error::NiaServerResult;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct NiaGetDefinedMappingsRequest {}
impl NiaGetDefinedMappingsRequest {
pub fn new()... |
fn integer() {
let _unsigned_8bit: u8 = 255;
let _unsigned_16bit: u16 = 65535;
let _unsigned_32bit: u32 = 4294967295;
let _unsigned_64bit: u64 = 18446744073709551615;
let _unsigned_128bit: u128 = 340282366920938463463374607431768211455;
let _unsigned_arch_size: usize = 18446744073709551615;
let _signed_8bit: ... |
#[doc = "Reader of register ADC_HTR3"]
pub type R = crate::R<u32, super::ADC_HTR3>;
#[doc = "Writer for register ADC_HTR3"]
pub type W = crate::W<u32, super::ADC_HTR3>;
#[doc = "Register ADC_HTR3 `reset()`'s with value 0"]
impl crate::ResetValue for super::ADC_HTR3 {
type Type = u32;
#[inline(always)]
fn re... |
use super::DIMENSION;
use board::Board;
use tile::Tile;
fn get_dimension() -> Vec<usize> {
vec![0; DIMENSION]
.iter()
.enumerate()
.map(|(i, _)| i)
.collect()
}
fn times<F>(times: usize, mut f: F) where F: FnMut() {
for _ in 0..times {
f();
}
}
// 0 -> left, 1 -> ... |
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
mod global_state;
use std::fs;
use std::io;
use std::path::PathBuf;
use std::sync::Arc;
use anyho... |
use tonic::Code;
mod wiremock_gen {
wiremock_grpc::generate!("hello.Greeter", MyMockServer);
}
use wiremock_gen::*;
use wiremock_grpc::*;
use wiremock_grpc_protogen::HelloReply;
#[tokio::test]
#[should_panic(expected = "Server terminated with unmatched rules: \n/")]
async fn mock_builder() {
let mut server =... |
// 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 {
super::{puppet, results, trials},
failure::Error,
};
pub fn run(
puppet: &mut puppet::Puppet,
trials: trials::TrialSet,
results:... |
#[doc = "Register `DDRCTRL_DFILPCFG0` reader"]
pub type R = crate::R<DDRCTRL_DFILPCFG0_SPEC>;
#[doc = "Register `DDRCTRL_DFILPCFG0` writer"]
pub type W = crate::W<DDRCTRL_DFILPCFG0_SPEC>;
#[doc = "Field `DFI_LP_EN_PD` reader - DFI_LP_EN_PD"]
pub type DFI_LP_EN_PD_R = crate::BitReader;
#[doc = "Field `DFI_LP_EN_PD` writ... |
use crate::models::money_node::{NewMoneyNode, UpdateMoneyNode};
use crate::models::transaction::{
ExpandedTransaction, InputUpdateTransaction, NewInputTransaction,
};
use crate::models::Expandable;
use crate::{
models::transaction::{NewTransaction, Transaction, UpdateTransaction},
schema::{transactions, tra... |
use std::collections::HashMap;
enum Direction {
Up,
Down,
Left,
Right,
}
fn main() {
const N: u32 = 361527;
let mut x = 0i32;
let mut y = 0i32;
let mut square_size = 1;
let mut i = 1;
let mut v: Option<u32> = None;
let mut vals = HashMap::new();
vals.insert((0, 0), 1);
... |
use std::path::{self, Path};
use std::sync::Arc;
use std::{fs, io};
use anyhow::Result;
use crossbeam_channel::Sender;
use jsonrpc_core::Value;
use serde_json::json;
use icon::prepend_filer_icon;
use crate::stdio_server::providers::builtin::{OnMove, OnMoveHandler};
use crate::stdio_server::{
rpc::Call,
sessi... |
//! Utility functions for tree manipulation.
//!
//! The rules in here are, that you are not allowed to reference any of our Paco
//! Ŝako specific data structures. I hope that way the core graph algorithms are
//! more easily understood.
use fxhash::FxHashMap;
use std::hash::Hash;
/// This is a redesign of the trace... |
use std::borrow::Cow;
use std::error::Error;
use heed_traits::{BytesDecode, BytesEncode};
use bytemuck::PodCastError;
/// Describes the `()` type.
pub struct Unit;
impl BytesEncode for Unit {
type EItem = ();
fn bytes_encode(_item: &Self::EItem) -> Result<Cow<[u8]>, Box<dyn Error>> {
Ok(Cow::Borrowe... |
use failure::Fail;
pub use img_hash::HashType as InnerHashType;
use lazy_static::lazy_static;
use std::collections::HashMap;
use std::str::FromStr;
use std::string::ToString;
lazy_static! {
static ref HASH_TYPES: HashMap<&'static str, HashTypeWrapper> = {
vec![
("Block",
HashTypeWrapper... |
fn is_prime(n: u32) -> bool {
if n < 2 {
return false;
}
if n % 2 == 0 {
return n == 2;
}
if n % 3 == 0 {
return n == 3;
}
if n % 5 == 0 {
return n == 5;
}
let mut p = 7;
const WHEEL: [u32; 8] = [4, 2, 4, 2, 4, 6, 2, 6];
loop {
for w in... |
extern crate reqwest;
extern crate roxmltree;
extern crate chrono;
use chrono::prelude::*;
mod call;
use call::*;
fn main() -> Result<(), Box<std::error::Error>> {
//let call: String = Thing::new()
// .with_id(174430)
// .with_id(167791)
// .with_id(173346)
// .with_type(ThingType::B... |
pub use self::transform::*;
pub use self::transform_system::*;
mod transform;
mod transform_system; |
use std::fmt::{Display, Result, Formatter};
use position::*;
type P = Position;
#[derive(Debug, Clone)]
pub enum Token<'a> {
Let(P),
Ident(P, &'a str),
StrLit(P, &'a str),
NumLit(P, &'a str),
LeftPar(P),
RightPar(P),
LeftBracket(P),
RightBracket(P),
LeftBrace(P),
RightBrace(P),
Assign(P),
Plus(P),
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.