text stringlengths 8 4.13M |
|---|
//! A simple animation library using the `crow` rendering crate.
use crow::Texture;
#[derive(Debug, Clone)]
pub struct Sprite {
pub texture: Texture,
pub offset: (i32, i32),
}
#[derive(Debug, Clone)]
pub struct AnimationState {
pub current: AnimationHandle,
pub frame: usize,
}
#[derive(Debug, Clone, ... |
mod assigment1;
mod assigment2;
mod assigment3;
mod extra_programs;
mod practice_work;
fn main() {
// assigment1::Question1::Question1();
// assigment1::Question2::Question2();
// assigment1::Question3::Question3();
// assigment1::Question4::Question4();
// assigment1::Question5::Question5();
... |
#[doc = "Register `CRR2` reader"]
pub type R = crate::R<CRR2_SPEC>;
#[doc = "Register `CRR2` writer"]
pub type W = crate::W<CRR2_SPEC>;
#[doc = "Field `BASEADDR` reader - base address for region x This alias address is replaced by REMAPADDR field. The only useful bits are \\[28:RI\\], where 21 ≤ RI ≤ 27 is the number o... |
use std::collections::HashMap;
use std::path::{Path, PathBuf};
use crate::parser::ast;
/// This exists to make the code more readable. It cannot be changed.
const WORD_SIZE: usize = std::mem::size_of::<u32>();
#[derive(Debug)]
pub enum ErrorTag {
Unknown,
IOError(std::io::Error),
ParserError(crate::pars... |
use crate::{
lexer::Token,
parser::{ParseError, Sink},
syntax::{SyntaxError, SyntaxErrorKind, SyntaxKind},
SyntaxDatabase, SyntaxTables,
};
use core::{fmt, mem};
use text_unit::{TextRange, TextUnit};
use valis_ds::Intern;
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
pub enum Event {
Start {
... |
#[macro_use] mod types;
mod deserialize;
mod hasher;
mod args;
mod leanpath;
mod loader;
mod tokens;
mod lint;
mod lexer;
mod rough_parser;
mod union_find;
#[allow(dead_code)] mod trie;
use std::io;
use std::io::{Write};
use std::path::*;
use std::fs::File;
use std::ffi::{OsString};
use self::args::*;
use self::leanp... |
use std;
use std::io;
use std::io::Write;
use crate::vm::Vm;
pub struct Repl {
command_buffer: Vec<String>,
vm: Vm,
}
impl Repl {
pub fn new() -> Repl {
Repl {
vm: Vm::new(),
command_buffer: vec![],
}
}
pub fn run(&mut self){
println!("Welcome to Excavator Vm !!");
loop {
... |
use std::collections::HashMap;
use super::super::utils::http_get;
use crate::error::Result;
use serde::{Deserialize, Serialize};
use serde_json::Value;
const BASE_URL: &str = "https://api.dydx.exchange";
#[derive(Clone, Serialize, Deserialize)]
#[allow(non_snake_case)]
struct PerpetualMarket {
market: String,
... |
use rand::rngs::ThreadRng;
use std::rc::Rc;
use super::{HitRecord, Shape};
use crate::aabb::AABB;
use crate::ray::Ray;
pub struct ShapeList {
pub shapes: Vec<Rc<dyn Shape>>,
}
impl ShapeList {
pub fn new(shapes: Vec<Rc<dyn Shape>>) -> Self {
Self { shapes }
}
pub fn add(&mut self, shape: Rc<... |
use tcod::colors::Color;
use tcod::map::FovAlgorithm;
pub static LIMIT_FPS: i32 = 60;
pub static SCREEN_WIDTH: i32 = 80;
pub static SCREEN_HEIGHT: i32 = 50;
pub static BAR_WIDTH: i32 = 20;
pub static PANEL_HEIGHT: i32 = 7;
pub static PANEL_Y: i32 = SCREEN_HEIGHT - PANEL_HEIGHT;
pub static MSG_X: i32 = BAR_WIDTH... |
extern crate errol;
use errol::kitchensink::launch_server;
fn main() {
launch_server();
}
|
/*
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product a * b * c.
*/
fn is_square(n: f64) -> bool {
n.sqrt().floor() == n.sqrt()
}
pub fn find() -> Option<u32> {
let mut c_sq: f64; // c squared
let targ: u32 = 1000;
for a in 1..targ {
for b in 1..targ {
... |
use std::collections::HashMap;
use crate::matrix::{size::*, Matrix, SizeMarker};
use crate::Error;
pub mod models {
use super::*;
use crate::matrix::Matrix;
include!(concat!(env!("OUT_DIR"), "/models.rs"));
}
#[derive(Debug)]
pub struct ModelData<I, N, O> {
pub norm: FieldsDescribe,
pub weights:... |
use std::sync::{Arc, Mutex};
use structopt::StructOpt;
use tonic::{transport::Server, Request, Response, Status};
use pomodoro::session_server::{Session, SessionServer};
use pomodoro::{
get_state_response::{Phase, Remaining},
GetStateRequest, GetStateResponse, StartRequest, StartResponse,
StopRequest, Stop... |
/*
* 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
*/
/// HostMuteResponse : Response with the list of muted host for your organization.
#[derive(Clone, De... |
use std::mem;
use std::vec;
fn main() {
println!("Hello, world!");
temp_ch(24.0, true);
let sunflower = fib_num(12);
println!("Fibonacci number is : {}", sunflower);
christmas12()
}
fn temp_ch(mut num: f32, c: bool){
if c == true {
num = num * 1.8 + 32.0;
println!("is {} F"... |
use serde_json::Value;
/// A JSON Patch "test" operation.
///
/// Tests that a value at the target location is equal to a specified value.
///
/// [More Info](https://tools.ietf.org/html/rfc6902#section-4.6)
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
pub struct OpTest {
/// A string containing a JSON... |
#![allow(clippy::needless_lifetimes)]
use super::StarWars;
use crate::StarWarsChar;
use async_graphql::connection::{query, Connection, Edge, EmptyFields};
use async_graphql::{Context, Enum, Interface, Object, Result};
/// One of the films in the Star Wars Trilogy
#[derive(Enum, Copy, Clone, Eq, PartialEq)]
pub enum E... |
extern crate hyper;
extern crate rustc_serialize;
extern crate bbs;
use std::io::Read;
use std::net::TcpListener;
use hyper::Client;
use hyper::header::UserAgent;
use bbs::{BOT_ADDR, HTML_ADDR};
use bbs::UserClient;
fn main() {
// Create a bot user.
unimplemented!();
// Start TcpListener.
unimpleme... |
//! Json Web Token Services, presents creating jwt from google, facebook and email + password
pub mod profile;
use std::sync::Arc;
use chrono::Utc;
use diesel::connection::AnsiTransactionManager;
use diesel::pg::Pg;
use diesel::Connection;
use failure::Error as FailureError;
use failure::Fail;
use futures::future;
us... |
mod d_cluster;
mod d_color_cluster;
pub use self::d_cluster::*;
pub use self::d_color_cluster::*;
pub type DefLogShape = d_color_cluster::cluColorShape;
pub type DefLogNoColorShape = d_cluster::cluShape;
pub type DefLogColorShape = d_color_cluster::cluColorShape;
|
use crate::panes::PositionAndSize;
use nix::fcntl::{fcntl, FcntlArg, OFlag};
use nix::pty::{forkpty, Winsize};
use nix::sys::signal::{kill, Signal};
use nix::sys::termios;
use nix::sys::wait::waitpid;
use nix::unistd;
use nix::unistd::{ForkResult, Pid};
use std::io;
use std::io::prelude::*;
use std::os::unix::io::RawFd... |
extern crate proc_macro;
use sde_sandbox::GivenStatement;
// This is a sample of a macro for custom structure parsing
// It can be used as
// ```
// bdd_macro!(Given Point);
//
// fn main() {
// test_bdd_macro();
// }
// ```
#[proc_macro]
pub fn bdd_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream ... |
use super::*;
use stun::errors::*;
#[test]
fn test_priority_get_from() -> Result<(), Error> {
let mut m = Message::new();
let mut p = PriorityAttr::default();
let result = p.get_from(&m);
if let Err(err) = result {
assert_eq!(err, ERR_ATTRIBUTE_NOT_FOUND.clone(), "unexpected error");
} els... |
/*
* Slack Web API
*
* One way to interact with the Slack platform is its HTTP RPC-based Web API, a collection of methods requiring OAuth 2.0-based user, bot, or workspace tokens blessed with related OAuth scopes.
*
* The version of the OpenAPI document: 1.7.0
*
* Generated by: https://openapi-generator.tech
*... |
use {quote, syn, utils};
use abi::eth::NamedSignature;
pub struct Interface {
name: String,
endpoint_name: String,
client_name: String,
items: Vec<Item>,
}
pub struct Event {
pub name: syn::Ident,
pub method_sig: syn::MethodSig,
indexed: Vec<(syn::Pat, syn::Ty)>,
data: Vec<(syn::Pat, syn::Ty)>,
signature: Na... |
use std::time::SystemTime;
use std::thread;
use std::sync::{mpsc, Arc};
fn main() {
let args: Vec<String> = std::env::args().collect();
// Matrix 1
let mut input = String::new();
std::io::stdin().read_line(&mut input).expect("failed to readline");
let n: usize = input.trim().parse().unwrap();
... |
use clap::ArgMatches;
use pnet::datalink::MacAddr;
use pnet::packet::icmpv6::ndp;
use pnet::packet::icmpv6::ndp::MutableRouterAdvertPacket;
use std::net::Ipv6Addr;
use std::str::FromStr;
use packet_builder::*;
pub fn set_mtu_opt(opts: &mut Vec<ndp::NdpOption>, args: &ArgMatches) {
if let Some(mtu_str) = args.valu... |
use crate::core::{hash_password, Error, Service, User};
use crate::driver;
/// List users where ID is less than.
pub fn list_where_id_lt(
driver: &driver::Driver,
_service_mask: Option<&Service>,
lt: i64,
limit: i64,
) -> Result<Vec<i64>, Error> {
driver
.user_list_where_id_lt(lt, limit)
... |
use *;
use fnv::FnvHashMap as HashMap;
/// Used to store temporary values of shared functions to speed up computation.
/// By default, all function outputs that are referenced more than once are cached.
/// To signal that some function output should be cached, `None` is stored in a hash map.
/// When performing the f... |
// Handles the CloudWatch bucket metrics
#![forbid(unsafe_code)]
#![deny(missing_docs)]
use crate::common::{
BucketNames,
StorageTypes,
};
use aws_sdk_cloudwatch::types::Metric;
use std::collections::HashMap;
use std::string::ToString;
use tracing::debug;
// This Hash is keyed by bucket name and contains a lis... |
#[cfg(test)]
#[path = "../../../tests/unit/construction/constraints/pipeline_test.rs"]
mod pipeline_test;
use crate::construction::heuristics::{ActivityContext, RouteContext, SolutionContext};
use crate::models::common::Cost;
use crate::models::problem::Job;
use hashbrown::HashSet;
use std::slice::Iter;
use std::sync:... |
use std::io::Write;
use crate::treeer::errors::TreeerErr;
pub trait Render {
fn render_string(&self, cap: usize) -> Result<String, TreeerErr> {
let mut s = Vec::with_capacity(cap);
self.write(&mut s)?;
Ok(String::from_utf8(s).unwrap())
}
fn write<W: Write>(&self, w: &mut W) -> Res... |
use std::borrow::Borrow;
use std::fmt;
use std::os::raw::c_char;
use std::str;
#[derive(Clone, Hash, Ord, Eq, PartialOrd, PartialEq)]
pub struct ImString(Vec<u8>);
impl ImString {
pub fn new<T: Into<String>>(value: T) -> ImString {
unsafe { ImString::from_utf8_unchecked(value.into().into_bytes()) }
}
... |
use bare_io::{self, Read, Write, BufRead};
use core::cmp::min;
use seek_forward::{SeekForward, SeekAbsolute, Tell, SeekRewind, SeekEnd, SeekBackward};
/// Creates an isolated segment of an underlying stream.
///
/// Seeks past the region will be capped, and reaching the end of
/// the region will result in EOF when re... |
//! Tests auto-converted from "sass-spec/spec/libsass-closed-issues/issue_1415"
#[allow(unused)]
use super::rsass;
// From "sass-spec/spec/libsass-closed-issues/issue_1415/direct.hrx"
#[test]
fn direct() {
assert_eq!(
rsass(
"@if & {\
\n foo {\
\n foo: bar;\
... |
use crate::actions::errors::Error;
use crate::actions::progress::Progress;
use crate::file::{open_file, write_file};
use crate::help::HELP_MSG;
use crate::input::Input;
use crate::{Aes, Signer};
use ares::ciphers::Cipher;
use ares::encrypted_file::EncryptedFile;
use ares::raw_key::RawKey;
use ares::signers::Signer as S... |
extern crate cascading_ui;
extern crate wasm_bindgen_test;
use self::{
cascading_ui::{test_header, test_setup},
wasm_bindgen_test::wasm_bindgen_test,
};
test_header!();
#[wasm_bindgen_test]
fn level_1() {
test_setup! {
?click {
.a {
color: "blue";
}
a {
text: "hello world";
}
}
}
assert_e... |
use crate::ast::rules;
use super::utils::{interpret_rule, interpret_rule_env};
#[test]
fn test_closure_eval() {
let (val, mut _env) = interpret_rule("function () break; end", rules::functiondef);
assert_eq!(val, "Function { id: 1, parameters: [], varargs: false, body: Block { statements: [Break, Terminal(SEMI... |
use crate::API_SERVER_BASE;
use chrono::{DateTime, FixedOffset, Utc};
use structopt::StructOpt;
use uuid::Uuid;
#[derive(StructOpt, Debug)]
pub struct Command {}
#[derive(Deserialize, Debug)]
struct ResBody {
schedules: Vec<ResSchedule>,
}
#[derive(Deserialize, Debug)]
struct ResSchedule {
art_id: Uuid,
... |
// derives fmt::Debug
#[derive(Debug)]
struct Structure(i32);
// nest Structure in yet another struct
#[derive(Debug)]
struct Deep(Structure);
fn main() {
// Similar to dumb replacement
println!("{:?} months in a year", 12);
println!("{1:?} {0:?} is the {actor:?} name.",
"Slater",
"Christi... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - control register"]
pub cr: CR,
#[doc = "0x04 - status register"]
pub sr: SR,
#[doc = "0x08 - data input register"]
pub dinr: DINR,
#[doc = "0x0c - data output register"]
pub doutr: DOUTR,
#[doc = "0x10 -... |
//! Manifest parsing structures
use anyhow::anyhow;
use anyhow::Error as AnyError;
use itertools::iproduct;
use serde::Deserialize;
use serde_yaml;
use std::collections::HashMap;
use std::fmt;
use std::path::PathBuf;
use mustache::MapBuilder;
use mustache;
type ManifestBuildMatrix = HashMap<String,Vec<Version>>;
type... |
use proconio::{input, marker::Usize1};
// セグメントツリー。セグ木。
// 更新と出力の両方が頻繁にあり、普通にやっても累積和でやってもだめな場合の折衷案として使えます。
// モノイドで使えます。
// 可逆な場合(つまり群の場合)はBinary Indexed Treeの方がいいかも?
// このコードは、ABC185のF問題に提出してACしたものです。
fn main() {
// TODO: 入力やqueryの内容も問題によって違うから直してね
input! {
n:usize,
q:usize,
a:[usize... |
struct Foo {
x: i32,
}
impl Drop for Foo {
fn drop(&mut self) {
println!("drop Foo{{{}}}", self.x)
}
}
fn main() {
let v = vec![1, 2, 3];
for e in &v {
println!("{}", e);
println!("{}", v.len());
}
println!(
"\\x -> x+1: {:?}",
v.iter().map(|x| x +... |
pub(crate) const WORD_SIZE: usize = std::mem::size_of::<usize>();
pub(crate) type OpArgBuf = [usize; 1];
pub mod bytecode;
pub mod vm;
#[cfg(test)]
mod tests;
|
//!
//! A module that provides safe wrappers about interrupts.
//!
/// The `table` module provides a structure representing an `Interrupt
/// Descriptor Table`.
mod table;
/// The `entry` module provides a struct representing an entry in the
/// `Interrupt Descriptor Table`.
mod entry;
/// The `handler` module provi... |
use std::collections::HashSet;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::ops::RangeInclusive;
#[derive(Debug, Hash, Eq, PartialEq)]
struct Point {
x: usize,
y: usize,
}
#[derive(Debug)]
struct LineSegment(Point, Point);
/**
Note to self: If I were to go back and do this again, I'd pursue... |
#[doc = "Writer for register TX_DATA_FIFO_WR2"]
pub type W = crate::W<u32, super::TX_DATA_FIFO_WR2>;
#[doc = "Register TX_DATA_FIFO_WR2 `reset()`'s with value 0"]
impl crate::ResetValue for super::TX_DATA_FIFO_WR2 {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
0
}
}
#[doc ... |
use metrics::asana::*;
use metrics::config::*;
use clap::{App, Arg};
use env_logger;
use futures::future::{join, join3, join_all};
use serde_json;
use std::collections::HashSet;
use std::fs;
use std::path::{Path, PathBuf};
use tokio;
fn main() {
/* Logging */
env_logger::init();
/* Command Line */
le... |
use std::env::current_dir;
use std::fs::{create_dir, read, remove_dir_all, remove_file, File};
use std::io::Write;
use std::path::PathBuf;
use clap::ArgMatches;
use dirs::home_dir;
use indicatif::ProgressBar;
use walkdir::WalkDir;
use crate::errors::{BoilrError, StandardResult};
use crate::utils::terminal::{alert, as... |
use super::{get_number_bytes, NumberBytes};
use nu_engine::CallExt;
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{
Category, Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Value,
};
#[derive(Clone)]
pub struct SubCommand;
impl Comm... |
#[derive(Debug)]
pub enum Error {
ArchiveFileName(std::path::StripPrefixError, std::path::PathBuf),
CreateArchive(std::io::Error, Option<String>),
OpenFile(std::io::Error, String),
PathNotADir(String),
StdIOError(std::io::Error),
}
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::f... |
pub struct Strutil {}
impl Strutil {
pub fn fall_within(ms: &str, ss: &str) -> bool {
match ms.find(ss) {
Some(i) => {
if i == 0 || i == ms.len() - 1 {
return false;
}
return true;
}
None => false,
... |
use std::convert::TryInto;
use std::marker::PhantomData;
use integer_encoding::VarInt;
#[derive(Copy, Clone)]
pub struct VarScalarOffset<T: VarEncodable> {
addr: usize,
phantom: PhantomData<T>,
}
impl<T: VarEncodable> VarScalarOffset<T> {
fn new(addr: usize) -> Self {
Self { addr, phantom: Phanto... |
struct Solution;
use std::collections::LinkedList;
impl Solution {
pub fn daily_temperatures(t: Vec<i32>) -> Vec<i32> {
let mut res = vec![0; t.len()];
let mut stack = LinkedList::new();
for (i, temperature) in t.iter().enumerate() {
let mut front = stack.front();
... |
/// ExternalWiki represents setting for external wiki
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct ExternalWiki {
/// URL of external wiki.
pub external_wiki_url: Option<String>,
}
impl ExternalWiki {
/// Create a builder for this object.
#[inline]
pub fn builder() -> Extern... |
#[allow(dead_code)]
#[derive(Debug, Copy, Clone)]
#[repr(u8)]
pub enum Op {
Nop = 0,
ShallowArgumentRef0 = 1,
ShallowArgumentRef1 = 2,
ShallowArgumentRef2 = 3,
ShallowArgumentRef3 = 4,
ShallowArgumentRef = 5,
DeepArgumentRef = 6,
GlobalRef = 7,
CheckedGlobalRef = 8,
Constant = 9,... |
#![deny(unsafe_op_in_unsafe_fn)]
pub mod ffi;
pub mod flamegraph;
pub mod linecache;
pub mod memorytracking;
pub mod mmap;
pub mod oom;
pub mod python;
mod rangemap;
pub mod util;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate derivative;
|
import core::{vec, uint, str, option, result};
import option::{some, none};
type filename = str;
type file_pos = {ch: uint, byte: uint};
/* A codemap is a thing that maps uints to file/line/column positions
* in a crate. This to make it possible to represent the positions
* with single-word things, rather than pas... |
use std::fmt::Arguments;
use std::io;
///Generalization of the basic methods of information output
pub trait LogBase<'a> {
fn unknown<'s>(&'a self, name: &'static str, args: Arguments<'s>) -> io::Result<()>;
fn trace<'s>(&'a self, line: u32, pos: u32, file: &'static str, args: Arguments<'s>) -> io::Result<()>;
... |
struct Hero {
name: String
}
struct World {
hero: Box<Hero>
}
impl Drop for Hero {
fn drop(&mut self) {
println!(
"Oh no !!! Our hero {} is defeated",
self.name
);
}
}
impl Drop for World {
fn drop(&mut self) {
println!("The world ends here !!!");
... |
// Include the traits module
mod traits;
// Import them ...
// ... @note that the trait must be imported too
use crate::traits::{notify, NewsArticle, Summary, Tweet};
fn main() {
let number_list = vec![34, 50, 25, 100, 65];
let str_list = vec!["d", "z", "f", "a", "c"];
println!(
"The largest numbe... |
/// optimization options:
/// 1. None -> Fastest, but not correct looking (paths and text are not reduced)
/// 2. Fast -> Fast and correct looking (text are reduced)
/// 3. All -> Correct looking but slow (paths and text are reduced)
#[derive(Debug, Clone)]
pub struct Settings {
pub text_width: f32,
pub te... |
/*!
An algorithm that composes algorithms and data structures throughout this
crate. This is where the magic happens.
*/
use std::{collections::HashSet, hash::BuildHasherDefault, time::Instant};
use rustc_hash::FxHasher;
use crate::{
crossword::{Crossword, WordIterator},
parse::parse_word_boundaries,
tri... |
pub fn ensure_directory(dir: &std::path::Path) {
if !dir.exists() {
std::fs::create_dir(dir).unwrap();
}
}
pub fn format_and_trim(part1: &str, part2: &str) -> String {
let output = format!("{}/{}", part1, part2);
output.trim().to_string()
}
|
// Copyright 2018 Dmitry Tantsur <divius.inside@gmail.com>
//
// 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 ap... |
extern crate rdb;
extern crate search;
use rdb::{show_posts, create_post, publish_post, delete_post};
use search::{create_index};
pub fn search_index_create(src: &str, des: &str) {
println!("index ...");
create_index(src, des);
}
pub fn txt_search() {
println!("search ...");
}
pub fn rdb_show_posts() {... |
#![cfg(all(test, feature = "test_e2e"))]
use azure_core::prelude::*;
use azure_storage::blob::prelude::*;
use azure_storage::core::prelude::*;
use futures::stream::StreamExt;
#[tokio::test]
async fn create_blob_and_stream_back() {
code().await.unwrap();
}
async fn code() -> Result<(), Box<dyn std::error::Error + ... |
use nom::bytes::complete::tag;
use nom::character::complete::alpha1;
use nom::character::complete::anychar;
use nom::character::complete::digit1;
use nom::character::complete::space1;
use nom::combinator::map;
use nom::IResult;
use std::{fs, io};
fn parse_num(input: &str) -> IResult<&str, usize> {
map(digit1, |di... |
#[derive(Debug)]
struct User {
username: String,
password: String,
}
impl User {
fn saluda(& self) {
println!("Hola, soy el usuario {}", self.username);
}
fn change_password(&mut self, new_password: String){
self.password = new_password;
}
}
fn main() {
let mut usuar... |
use std::sync::Arc;
use async_trait::async_trait;
use common::error::Error;
use common::event::{Event, EventHandler};
use common::result::Result;
use shared::event::PublicationEvent;
use crate::domain::catalogue::{CatalogueRepository, PublicationService};
pub struct PublicationHandler {
catalogue_repo: Arc<dyn ... |
use crate::{
environment::Environment, evaluator::Evaluator, lexer::Lexer,
parser::Parser,
};
use std::rc::Rc;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn run(code: &str) -> String {
let env = Environment::new();
let l = Lexer::new(code);
let mut p = Parser::new(l);
let program = p.pa... |
use sodium_rust::{IsLambda1, Stream};
pub fn filter_map<A, B, FN>(s: &Stream<A>, f: FN) -> Stream<B>
where
FN: IsLambda1<A, Option<B>> + Send + Sync + 'static,
A: Clone + Send + 'static,
B: Clone + Send + 'static,
{
s.map(f).filter_option()
}
|
#[doc = "Reader of register INTR_MASKED"]
pub type R = crate::R<u32, super::INTR_MASKED>;
#[doc = "Reader of field `CH`"]
pub type CH_R = crate::R<bool, bool>;
impl R {
#[doc = "Bit 0 - Logical and of corresponding INTR and INTR_MASK fields."]
#[inline(always)]
pub fn ch(&self) -> CH_R {
CH_R::new((... |
use std::fmt;
use hashbrown::HashMap;
use std::hash::{Hash,Hasher};
use std::cell::RefCell;
use std::rc::Rc;
use crate::ast;
use crate::code;
use code::InstructionsFns;
use enum_iterator::IntoEnumIterator;
#[derive(Hash, Eq, PartialEq, Clone, Debug)]
pub enum Object {
Int(i64),
Bool(bool),
String(String),
... |
use std::cmp::max;
use failure::Error as FailureError;
use validator::{Validate, ValidationErrors};
use models::{Country, Pickups, ShippingVariant};
use stq_static_resources::Currency;
use stq_types::{BaseProductId, CompanyId, CompanyPackageId, PackageId, ProductPrice, ShippingId, StoreId};
use schema::companies_pac... |
use std::marker::PhantomData;
use num_traits::{Zero, One};
use totsu_core::solver::{Solver, SliceLike, Operator, Cone};
use totsu_core::{LinAlgEx, MatOp, ConeRotSOC, ConeRPos, ConeZero, splitm, splitm_mut};
use crate::MatBuild;
//
pub struct ProbQPOpC<L: LinAlgEx>
{
ph_l: PhantomData<L>,
n: usize,
... |
use std::collections::HashMap;
use crate::{body::Body, request::Method, Response};
#[derive(Derivative, Debug)]
#[derivative(Default(new = "true"))]
pub struct ResponseBuilder {
headers: HashMap<String, String>,
body: Option<Body>,
status: Option<u16>,
reason: Option<String>,
method: Option<Method... |
#[doc = "Register `SR` reader"]
pub type R = crate::R<SR_SPEC>;
#[doc = "Field `INITOK` reader - PKA initialization OK This bit is asserted when PKA initialization is complete. When RNG is not able to output proper random numbers INITOK stays at 0."]
pub type INITOK_R = crate::BitReader;
#[doc = "Field `LMF` reader - L... |
use crate::prelude::*;
use crate::parser::parse::flag::{Flag, FlagKind};
use crate::parser::parse::operator::Operator;
use crate::parser::parse::pipeline::{Pipeline, PipelineElement};
use crate::parser::parse::token_tree::{DelimitedNode, Delimiter, PathNode, TokenNode};
use crate::parser::parse::tokens::{RawNumber, Ra... |
// *
// - perhaps a parsing subsystem with an interface that just gives available expressions
// - BoolExpr
// - NoneExpr?
// - ListExpr?
// - List type definitely
// - Logo has separate function and variable definitions. It doesn't like builtin names for function names.
// - TODO: Prefix operators should take only th... |
use std::{collections::VecDeque, path::Path, process::exit};
use crate::{command_handler::compiler_info::CompilerMode, laze_parser::parser::LazeParser};
use super::compiler_info::{CompilerInfo, OptionCompilerInfo};
pub fn handle_args(arguments: std::env::Args) -> CompilerInfo {
let mut args_vector: VecDeque<Stri... |
use crate::bank::Bank;
use solana_sdk::signature::Keypair;
use solana_sdk::transaction::{Transaction, TransactionError};
pub struct BankClient<'a> {
bank: &'a Bank,
keypair: Keypair,
}
impl<'a> BankClient<'a> {
pub fn new(bank: &'a Bank, keypair: Keypair) -> Self {
Self { bank, keypair }
}
... |
// Copyright (c) 2019, Facebook, Inc.
// All rights reserved.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
//
use quote::quote;
use syn::{Type, TypePath};
use synstructure::decl_derive;
decl_derive!([Ocamlvalue] => derive_ocamlvalue... |
#[doc = "Register `STGENR_PIDR2` reader"]
pub type R = crate::R<STGENR_PIDR2_SPEC>;
#[doc = "Field `DES_1` reader - DES_1"]
pub type DES_1_R = crate::FieldReader;
#[doc = "Field `JEDEC` reader - JEDEC"]
pub type JEDEC_R = crate::BitReader;
#[doc = "Field `REVISION` reader - REVISION"]
pub type REVISION_R = crate::Field... |
//! `May` Configuration interface
//!
use std::sync::atomic::{AtomicUsize, Ordering};
// default stack size, in usize
// windows has a minimal size as 0x4a8!!!!
const DEFAULT_STACK_SIZE: usize = 0x1000;
const DEFAULT_POOL_CAPACITY: usize = 1000;
static WORKERS: AtomicUsize = AtomicUsize::new(0);
static STACK_SIZE: A... |
extern crate libc;
use libc::{c_void, c_char, c_int, c_long, c_longlong};
use std::mem::{transmute};
#[repr(C)]
pub enum MPI_Error {
Success = 0,
Buffer = 1,
Count = 2,
Type = 3,
Tag = 4,
Comm = 5,
Rank = 6,
RequestOrRoot = 7,
Group =... |
//! Convert vector graphics into raster graphics
extern crate image;
mod object;
use crate::surface::{
Object,
Surface
};
use image::ColorType;
pub use image::error::ImageResult;
/// Data for a single picture element of a raster image
#[derive(Debug, Copy, Clone, PartialEq)]
enum Pixel {
/// Data for r... |
use crate::model::{Alignment::{Evil, Good}, Group, Super};
pub(in crate::tests) fn batman<'a>() -> Super<'a> {
Super {
super_name: "Batman",
real_name: "Bruce Wayne",
power: 50,
sidekick: Box::from(Some(robin())),
alignment: Good,
}
}
pub(in crate::tests) fn superman<'a... |
use crate::sidebar::make_section;
use crate::{
gui::{BuildContext, Ui, UiMessage, UiNode},
physics::Collider,
scene::commands::{
physics::{SetCapsuleBeginCommand, SetCapsuleEndCommand, SetCapsuleRadiusCommand},
SceneCommand,
},
send_sync_message,
sidebar::{
make_f32_input... |
mod b64;
mod lib;
fn main() {
use b64::*;
use lib::Indexer;
let dict: Dict = create_dict();
let _v = encode(&dict, &String::from("Save Our souls"));
let a = String::from("s: Box<str>");
println!("{:?}", a.get_at(3) );
}
|
extern crate regex;
use std::io::Read;
use std::path::Path;
use regex::Regex;
mod bf_interpreter;
use bf_interpreter::BfInterpreter;
fn main() {
std::process::exit(match run() {
Ok(_) => 0,
Err(message) => {
eprintln!("Error: {}", message);
1
}
})
}
fn run() ... |
use chrono::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum Receive {
Realtime,
Predefined(f64, f64)
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct WriteConfig {
pub write_at_least: usize,
pub data: Receive,
}
#[derive(Clone, Deb... |
use proconio::input;
use std::collections::HashMap;
fn main() {
input! {
k: i64,
s: String,
t: String,
}
let mut card_counts: Vec<i64> = vec![k; 9];
for c in (s.clone() + &t).chars() {
if !c.is_numeric() {
continue;
}
let k = c as usize - 48;
... |
//! compatible with std::sync::rwlock except for both thread and coroutine
//! please ref the doc from std::sync::rwlock
use std::cell::UnsafeCell;
use std::fmt;
use std::ops::{Deref, DerefMut};
use std::panic::{RefUnwindSafe, UnwindSafe};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
use std::syn... |
//! This module implements the application logic of `tc_seq`, that is, the code that pulls together
//! the algorithms for computing a tree-child sequence and for computing a cluster partition, in
//! order to compute the final result.
use app;
use tree_child::clusters;
use tree_child::network::TcNet;
use tree_child::... |
use crate::aoc_utils::read_input;
pub fn run(input_filename: &str) {
let input = read_input(input_filename);
part1(&input);
part2(&input);
}
fn part1(_input: &String) {}
fn part2(_input: &String) {}
|
struct Solution {}
impl Solution {
pub fn is_palindrome(mut x: i32) -> bool {
if x < 0 {
return false;
}
let mut y = x;
let mut z = 0;
while y!=0 {
z = z*10 + y%10;
y/=10;
}
x == z
}
/*
pub fn is_palindrome(mut ... |
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under both the MIT license found in the
* LICENSE-MIT file in the root directory of this source tree and the Apache
* License, Version 2.0 found in the LICENSE-APACHE file in the root directory
* of this source tree.
*/
//! A... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.