text stringlengths 8 4.13M |
|---|
use super::{Block, BlockId, Field};
use crate::{random_id::U128Id, resource::ResourceId, JsObject, Promise};
use std::collections::HashSet;
use wasm_bindgen::{prelude::*, JsCast};
#[derive(Clone)]
pub enum Icon {
None,
Resource(ResourceId),
DefaultUser,
}
#[derive(Clone)]
pub enum Sender {
System,
... |
//! GUI bottom footer
use std::sync::{Arc, Mutex};
use iced::alignment::{Horizontal, Vertical};
use iced::widget::horizontal_space;
use iced::widget::tooltip::Position;
use iced::widget::{button, Container, Row, Text, Tooltip};
use iced::{Alignment, Font, Length, Renderer};
use crate::gui::styles::button::ButtonType... |
/*
* 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.
*/
//! Everything related to ioctl arguments.
use serde::Deserialize;
use serde::Serialize;
use crat... |
/// Main architecture-independent kernel functionality
///
/// Called from `arch::kstart()`
pub fn kmain() {
println!("kmain()");
loop {}
}
|
pub mod home_page;
pub mod poll_results_page;
pub mod poll_voting_page;
pub mod profile_page;
pub use self::home_page::HomePage;
pub use self::poll_results_page::PollResultsPage;
pub use self::poll_voting_page::PollVotingPage;
pub use self::profile_page::ProfilePage;
|
use crypto::scrypt::{scrypt, ScryptParams};
use rust_sodium::crypto::secretbox::xsalsa20poly1305;
use crate::util::bytes_to_hex;
lazy_static! {
static ref SCRYPT_PARAMS: ScryptParams = ScryptParams::new(4, 8, 1);
}
pub fn generate_key(data: &str, salt_vec: &Vec<u8>) -> String {
let data_vec: Vec<u8> = data.b... |
extern crate iron;
extern crate iron_cms;
use iron::{Iron, Chain};
fn main() {
// Add routers
let mut chain = Chain::new(iron_cms::routes());
// Add db middleware
chain.link_before(iron_cms::middleware::db("postgres://postgres:qwe123qwe123@172.18.0.2:5432/test_db"));
// Add Template renderer and v... |
union IntOrFloat {
i: i32,
f: f32
}
fn main() {
let mut iof = IntOrFloat{ i: 123 };
unsafe
{
println!("unsafe union access {} ", iof.i);
}
unsafe
{
match iof
{
IntOrFloat { i } => println!("int {}", i),
IntOrFloat { f } => println!("float... |
//! A module that implements the Adobe RGB color space. The Adobe RGB space differs greatly from
//! sRGB: its components are floating points that range between 0 and 1, and it has a set of
//! primaries designed to give it a wider coverage (over half of CIE 1931).
use coord::Coord;
use color::{Color, XYZColor};
use c... |
extern crate pest;
#[macro_use]
extern crate pest_derive;
use pest::Parser;
use pest::prec_climber;
#[cfg(debug_assertions)]
const _GRAMMAR: &'static str = include_str!("ident.pest");
#[derive(Parser)]
#[grammar = "ident.pest"]
struct IdentParser;
fn main() { }
|
#![feature(plugin_registrar)]
#![feature(box_syntax, rustc_private)]
extern crate syntax;
extern crate syntax_pos;
// Load rustc as a plugin to get macros
#[macro_use]
extern crate rustc;
extern crate rustc_plugin;
extern crate docstrings;
extern crate ispell;
extern crate markdown;
mod helpers;
mod doc_params_mis... |
use std::io;
use std::convert::TryFrom;
use bytes::{BufMut, BytesMut};
use tokio_io::codec::{ Decoder, Encoder };
use varmint::{self, ReadVarInt, WriteVarInt};
use message::{Flag, Message};
#[derive(Debug, Clone, Copy)]
enum State {
/// We have not read any part of the message, waiting on the header value.
R... |
fn main(){
println!(" Hello Rust");
} |
use anyhow::Result;
use assembly_maps::lvl::reader::LevelReader;
use std::{fs::File, io::BufReader, path::PathBuf};
use structopt::StructOpt;
#[derive(StructOpt)]
struct Opt {
/// The lvl file to analyze
file: PathBuf,
}
fn main() -> Result<()> {
let opt = Opt::from_args();
let file = File::open(&opt... |
/*
* 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
*/
/// SyntheticsPrivateLocationSecretsAuthentication : Authentication part of the secrets.
#[derive(Clo... |
fn main() {
let main_text = [
"A partridge in a pear tree",
"Two turtle doves, and",
"Three french hens",
"Four colly birds",
"Five gold rings",
];
let words = ["first", "second", "third", "fourth", "fifth"];
for (i, word) in words.iter().enumerate() {
p... |
use std::io;
use std::sync::Arc;
use failure::Fallible;
pub use rpdf_graphics::font::{Font, FontMap};
pub use rpdf_graphics::text::{TextFragment, TextObject};
use rpdf_graphics::*;
use rpdf_lopdf_extra::*;
pub struct Document {
inner: Arc<lopdf::Document>,
pages: Vec<Page>,
}
impl Document {
pub fn par... |
//! Encoding of a binary [`SpawnAccount`].
//!
//! ```text
//!
//! +-----------+-------------+----------------+
//! | | | |
//! | Version | Template | Name |
//! | (u16) | (Address) | (String) |
//! | | | |
//! +-... |
#![no_main]
#![no_std]
// PWM Example
// PWM Output on Pin A6 (D12 on the Nucleo Board)
// nmt @ nt-com 2021
/// IMPORTS
use stm32f4::stm32f401;
use cortex_m_rt::entry;
#[allow(unused_extern_crates)]
extern crate panic_halt; // panic handler
/// FUNCTIONS
fn delay() {
for _i in 0..1000 {
// do nothing
}
}
//... |
use std::env;
use failure::Error;
use std::io::{self, Read};
use atty::Stream;
use std::io::{stdout, Write, BufWriter};
// エイリアス
pub type Result<T> = std::result::Result<T, Error>;
fn is_pipe() -> bool {
// Terminalでなければ標準入力から読み込む
! atty::is(Stream::Stdin)
}
fn read_from_stdin() -> Result<String> {
// パイ... |
use std::collections::HashSet;
use apllodb_shared_components::SchemaIndex;
use serde::{Deserialize, Serialize};
/// Projection query for single table columns.
#[derive(Clone, Eq, PartialEq, Debug, Serialize, Deserialize)]
pub enum RowProjectionQuery {
/// All columns in a table.
/// Note that this variant can... |
use crate::entity::user::{User, UserID};
use super::gateway::repository::user_repository::UserRepository;
pub struct UserOperation<U: UserRepository> {
pub ur: U
}
impl<U: UserRepository> UserOperation<U> {
pub fn create(&self) -> Option<User> {
self.ur.create()
}
pub fn find(&self, id: UserID... |
use super::{
dockarea::DockArea, rect::Rect, screen::Screen, windowwrapper::WindowWrapper,
workspace::Workspace, Direction, HandleState,
};
use crate::{
layout::LayoutTag,
xlibwrapper::{
util::{Position, Size},
xlibmodels::{MonitorId, Window},
},
};
use std::cell::RefCell;
use std::c... |
use crate::{
grid::config::ColoredConfig,
grid::config::Entity,
grid::dimension::CompleteDimensionVecRecords,
grid::records::{ExactRecords, PeekableRecords, Records, RecordsMut},
grid::util::string::count_lines,
settings::{measurement::Measurement, peaker::Peaker, CellOption, Height, TableOption... |
use super::drawable::Drawable;
use super::color::Color;
use super::canvas::*;
use wasm_bindgen::JsValue;
/// A drawable rectangle
pub struct Rectangle {
/// the [style](../canvas/struct.LineStyle.html) of the border
pub line_style: LineStyle,
/// point y and point y (in pixels)
pub top_left: (f64, f64)... |
#[macro_export]
macro_rules! fmt(($token:expr) => (format!("{:?}", $token)));
#[macro_export]
macro_rules! say_hello {
() => {
println!("Hello");
};
}
|
use anyhow::Result;
use std::fs;
#[derive(Eq, PartialEq, Hash, Clone, Copy, Debug, Default)]
struct Point {
x: isize,
y: isize,
}
#[derive(Debug)]
struct Ship {
position: Point,
waypoint: Point,
}
#[derive(Debug)]
enum Operation {
North(usize),
South(usize),
East(usize),
West(usize),
... |
use crate::types::{draft_version::DraftVersion, schema::Schema};
use std::{collections::HashMap, sync::Arc};
use url::Url;
pub(in crate) struct Scope {
pub(in crate) draft_version: DraftVersion,
// TODO: Verify if we need a thread-safe cache or this is good enough
pub(in crate) schema_cache: HashMap<Url, A... |
use std::path::{Path, PathBuf};
use clap::Parser as ClapParser;
use crate::error::{self, VestiCommandUtilErrKind};
#[derive(ClapParser)]
#[command(author, version, about)]
pub enum VestiOpt {
/// Initialize the vesti project
Init {
#[clap(name = "PROJECT_NAME")]
project_name: Option<String>,
... |
use std::sync::mpsc::Receiver;
use std::sync::mpsc::sync_channel;
use rocket::http::ContentType;
use rocket::http::Status;
use rocket::local::{Client, LocalResponse};
use crate::comms;
use crate::mechatronics::commands::RobotCommand;
use super::*;
struct TestEnvironment {
receiver: Receiver<Box<RobotCommand>>,
... |
use crate::gc::*;
use cons::*;
use self::{closure::Closure, macro_::Macro, package::Package, symbol::Symbol, vector::Vector};
pub type TagKind = u32;
pub const CMP_FALSE: i32 = 0;
pub const CMP_TRUE: i32 = 1;
pub const CMP_UNDEF: i32 = -1;
pub const FIRST_TAG: TagKind = 0xfff9;
pub const LAST_TAG: TagKind = 0xffff;
pu... |
use std::collections::HashMap;
use pyo3::prelude::*;
use crate::{CreateTableStatement, PropertyPair, RowFormat, StoredAs, TableColumn};
// add bindings to the generated Python module
// N.B: "rust2py" must be the name of the `.so` or `.pyd` file.
/// This module is implemented in Rust.
#[pymodule]
fn hive_ddl_parse... |
pub mod arbiter {
use core::cell::RefCell;
pub struct MicLease;
pub struct TimerLease;
pub static mut MIC: RefCell<MicLease> = RefCell::new(MicLease);
pub static mut TIMER0: RefCell<TimerLease> = RefCell::new(TimerLease);
pub static mut TIMER1: RefCell<TimerLease> = RefCell::new(TimerLease);
... |
enum CPUOp {
Add {
src1: usize,
src2: usize,
dst: usize,
},
Mul {
src1: usize,
src2: usize,
dst: usize,
},
Halt,
Undefined(u32),
}
impl CPUOp {
fn next_pc_offset(&self) -> usize {
match *self {
CPUOp::Add { .. } | CPUOp::Mu... |
use handlebars::*;
use itertools::join;
use std::collections::BTreeMap;
use serde_json::value::Value as Json;
use serde_json;
use url::Url;
// Change an array of items into a comma seperated list with formatting
// Usage: {{#comma-list array}}{{elementAttribute}}:{{attribute2}}{{/comma-list}}
pub(crate) fn comma_delim... |
//! Styx symbols are global identifiers for `Member`s, such as types or functions.
//!
//! This module provides the `Symbol` trait, useful for symbol lookup,
//! the `Sym` struct, its main implementation, and the `SymbolTree`, used to
//! efficiently lookup symbols based on their name.
use std::fmt::{self, Display, Fo... |
//! Get info on members of your Slack team.
use crate::http::{Cursor, Paging};
use crate::id::*;
use crate::Timestamp;
/// Lists all users in a Slack team.
///
/// Wraps https://api.slack.com/methods/users.list
/// At this time, providing no limit value will result in Slack
/// attempting to deliver you the entire re... |
#[derive(Debug, PartialEq)]
pub struct Clock {
minute_of_day: u16
}
impl Clock {
const MINUTES_IN_DAY: isize = 24 * 60;
pub fn new(hours: isize, minutes: isize) -> Self {
let total_minutes = (hours % 24) * 60 + minutes;
if total_minutes < 0 {
Self {
minute_of_da... |
#[cfg(feature = "in-use-encryption-unstable")]
mod csfle;
#[cfg(feature = "in-use-encryption-unstable")]
use self::csfle::*;
use std::{
collections::HashMap,
convert::TryInto,
fmt::Debug,
ops::Deref,
sync::{
atomic::{AtomicBool, Ordering},
Arc,
},
time::Duration,
};
use fut... |
use ::image;
pub use graphics::*;
use image::RgbaImage;
use opengl_graphics::{GlGraphics, Texture, TextureSettings};
use piston::input::RenderArgs;
use crate::caengine::SandBox;
pub struct CaRender {
width: u32,
height: u32,
}
impl CaRender {
pub fn render_sandbox(&mut self, sandbox: &SandBox, gl: &mut G... |
use super::bit_search::{find_last_one};
pub struct ForwardOnesIterator <'a> {
pub words : &'a[u64],
pub current_word : u64,
pub word_pos : usize,
pub word_limit : usize,
pub end_mask : u64,
}
impl <'a> Iterator for ForwardOnesIterator<'a> {
type Item = usize;
fn next(&mut self) -> Option<usize> {
... |
fn main() {
let string_entries: Vec<&str> = DAYS_INPUT.split(',').collect();
println!("string entries: {:?}", string_entries);
let mut int_entries: Vec<i32> = string_entries
.iter()
.map(|x| x.parse::<i32>().unwrap())
.collect();
// instructions say:
// replace position 1 wit... |
//! CoIo creation error
use std::{error, fmt, io};
/// CoIo creation error type
pub struct Error<T> {
err: io::Error,
data: T,
}
impl<T> Error<T> {
/// create error from io::Error and data
pub fn new(err: io::Error, data: T) -> Error<T> {
Error { err, data }
}
/// convert to inner dat... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - TZSC control register"]
pub cr: CR,
_reserved1: [u8; 0x0c],
#[doc = "0x10 - TZSC security configuration register"]
pub seccfgr1: SECCFGR1,
_reserved2: [u8; 0x0c],
#[doc = "0x20 - TZSC privilege configuration reg... |
extern crate bitpacker;
use std::collections::HashMap;
use bitpacker::{BitPacker, BitUnpacker};
#[derive(Debug)]
pub struct HuffmanNode {
pub key: Option<char>,
pub value: usize,
left: Option<Box<HuffmanNode>>,
right: Option<Box<HuffmanNode>>,
}
impl HuffmanNode {
fn new_leaf(key: char, value: usi... |
use crate::SizeError;
use std::{fmt, str::FromStr};
#[cfg(feature = "serde_de")]
use serde::{de, Deserialize, Deserializer, Serialize};
#[derive(Debug, PartialEq, Copy, Clone, Default)]
#[cfg_attr(feature = "serde_de", derive(Serialize))]
pub enum Size {
Large,
Medium,
#[default]
Small,
}
impl fmt::D... |
use winit::event::{Event, VirtualKeyCode, MouseButton, WindowEvent, DeviceEvent, KeyboardInput, ElementState};
use winit::dpi::PhysicalPosition;
use serde::{Serialize, Deserialize};
use crate::geometry2d::Point;
use crate::impl_ron_asset;
use crate::event;
// -----------------------------------------------------------... |
use anyhow::Error;
use fehler::throws;
use proc_macro2::{Ident, Span, TokenStream};
use quote::quote;
use std::fs;
use std::io::prelude::*;
#[throws(_)]
fn main() {
println!("cargo:rerun-if-changed=tests/");
let mut stream = TokenStream::new();
for entry in fs::read_dir("tests/")? {
let entry = ent... |
// 无重复字符的最长子串
// 给定一个字符串,请你找出其中不含有重复字符的 最长子串 的长度。
//
// 示例 1:
//
// 输入: "abcabcbb"
// 输出: 3
// 解释: 因为无重复字符的最长子串是 "abc",所以其长度为 3。
// 示例 2:
//
// 输入: "bbbbb"
// 输出: 1
// 解释: 因为无重复字符的最长子串是 "b",所以其长度为 1。
// 示例 3:
//
// 输入: "pwwkew"
// 输出: 3
// 解释: 因为无重复字符的最长子串是 "wke",所以其长度为 3。
// 请注意,你的答案必须是 子串 的长度,"pwke" 是一个子序列,不是子串
use ... |
//pub mod full_name;
//pub mod email_address;
//pub mod telephone;
//pub mod postal_address;
//pub mod contact_information;
//pub mod tenant_id;
//pub mod enablement;
//pub mod person;
pub mod user;
|
pub(crate) mod chain_rows;
pub(crate) mod from_sqlite_rows;
|
extern crate num_bigint;
extern crate num_traits;
use std::any;
use std::fmt;
use std::ops;
use crate::token::Token;
use num_bigint::BigInt;
use num_traits::ToPrimitive;
//////////////////////////////////////////////////////////////////////
/// Number
/////////////////////////////////////////////////////////////////... |
#![allow(dead_code)]
use crate::utils::*;
use std::ops;
#[derive(Debug, Copy, Clone)]
pub struct Vec3 {
e: [f64; 3],
}
impl Vec3 {
pub fn new() -> Self {
Self { e: [0.0, 0.0, 0.0] }
}
pub fn from(e0: f64, e1: f64, e2: f64) -> Self {
Self { e: [e0, e1, e2] }
}
pub fn random() ->... |
pub(crate) mod message;
pub(crate) mod input_message;
pub(crate) mod slsk_buffer;
pub(crate) mod packet;
pub(crate) trait Looper {
fn loop_forever(&mut self);
} |
mod protos;
use log::info;
use std::sync::Arc;
use structopt::StructOpt;
use grpcio::{ChannelBuilder, EnvBuilder};
use protos::bank_account::{
OpenBankAccountRequest,
UpdateBankAccountRequest,
DepositBankAccountRequest,
WithdrawBankAccountRequest,
CloseBankAccountRequest,
};
use protos::bank_a... |
use std::io::prelude::*;
use std::io;
use structopt::StructOpt;
use std::path::PathBuf;
use rpassword;
use reqwest::Url;
use std::thread;
use indicatif::{MultiProgress, ProgressBar, ProgressStyle};
use std::sync::Arc;
use std::fs::File;
use log::error;
mod logger;
mod config;
use config::{Config, State};
mod a... |
use super::*;
use db::{Database, Pod};
use event::obj::{Dispatch, Listener};
use file::FileReaderWriter;
use rocket::config::{Config, Environment};
use rocket::State;
use rocket::{get, post, routes};
use rocket_contrib::json::{Json, JsonValue};
use scan::{AutoScanner, ScannerRecvArgument};
use serde::{Deserialize, Seri... |
use std::path::PathBuf;
fn main() {
println!("cargo:rerun-if-changed=src");
rust_sitter_tool::build_parsers(&PathBuf::from("src/lib.rs"));
}
|
pub const DEFAULT_POINT_SIZE: i32 = 5;
pub const DEFAULT_FONT_COLOR: &str = "#080808";
pub const DEFAULT_FONT_FAMILY: &str = "sans-serif";
pub const DEFAULT_DY: &str = ".35em";
pub const DEFAULT_STROKE_WIDTH: i32 = 1;
pub const DEFAULT_STROKE_COLOR: &str = "#bbbbbb";
pub const X_ATTR: &str = "x";
pub const X1_ATTR: &... |
mod states;
pub use states::{Accepted, Calling, Completed, Errored, Proceeding, Terminated};
use crate::Error;
use crate::SipManager;
use common::{
rsip::{self, prelude::*},
tokio::time::Instant,
};
use models::{
transport::{RequestMsg, ResponseMsg},
RequestExt,
};
use std::sync::Arc;
//should come f... |
pub mod standard;
pub mod ngram;
use serde_json;
use serde_json::value::ToJson;
use kite::token::Token;
use analysis::ngram_generator::Edge;
use analysis::tokenizers::standard::StandardTokenizer;
use analysis::tokenizers::ngram::NGramTokenizer;
/// Defines a tokenizer
///
/// You can use this to define a tokenizer ... |
mod fixtures;
use fixtures::{server, Error, TestServer, DIRECTORIES, FILES};
use rstest::rstest;
use select::predicate::Attr;
use select::{document::Document, node::Node};
use std::fs::{remove_file, File};
use std::io::Write;
use std::path::PathBuf;
/// Do not show readme contents by default
#[rstest]
fn no_readme_co... |
use rand::{prelude::random, rngs::SmallRng, Rng, SeedableRng};
use structopt::StructOpt;
use std::{collections::BTreeMap, time};
#[macro_export]
macro_rules! pp {
($($arg:expr),+ => $val:expr) => {
println!("{:<30} : {:?}", format!($($arg),+), $val)
};
}
/// Command line options.
#[derive(Clone, Stru... |
use std::panic;
use rocket::{self, http::{Header, Status}, local::Client};
use diesel::connection::SimpleConnection;
use serde_json;
use horus_server::{self, routes::key::*};
use test::{run_test, sql::*};
#[test]
fn issue()
{
run(|| {
let client = get_client();
let req = client
.post(... |
use super::triangle::Triangle;
use super::mdl::MDL;
#[derive(Debug)]
pub struct Model {
pub triangles: Vec<Triangle>,
}
impl Model {
pub fn new (triangles: Vec<Triangle>) -> Model {
Model{ triangles }
}
pub fn from_mdl(file_path: &str) -> Model {
let mdl = MDL::open(file_path);
Model {
tri... |
use gfx;
use gfx::Bundle;
use gfx_app;
use gfx_app::ColorFormat;
use winit::{Event, ElementState, VirtualKeyCode};
use state::{State, Visible, PREVIEW_WIDTH};
use state::template::DeltaPos;
use state::color::Color;
gfx_defines!{
vertex Vertex {
pos: [f32; 2] = "pos",
}
pipeline pipe {
col... |
use std::env;
use std::error::Error;
use std::fs::File;
use std::path::Path;
use std::io::Read;
fn main() {
println!("Rusty Brainfuck Interpreter");
let args: Vec<String> = env::args().collect();
let path = Path::new(&args[1]);
let mut file = match File::open(&path) {
Err(why) => panic!("{}", w... |
use crate::device::Device;
use crate::sys;
#[allow(dead_code)]
pub struct Swapchain {
swapchain: sys::dxgi::Swapchain,
backbuffer: sys::dxgi::BackbufferRaw,
render_target: sys::direct2d::Bitmap,
}
impl Swapchain {
pub fn create_from_hwnd(device: &Device, hwnd: winapi::shared::windef::HWND) -> Self {
... |
#![doc = "generated by AutoRust 0.1.0"]
#![allow(non_camel_case_types)]
#![allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ErrorResponse {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub error: Option<ErrorDetails>,... |
//! Shibboleth SP authentication plugin for Gotham web applications
extern crate futures;
extern crate gotham;
#[macro_use]
extern crate gotham_derive;
extern crate hyper;
#[macro_use]
extern crate log;
#[macro_use]
extern crate percent_encoding;
extern crate serde;
#[macro_use]
extern crate serde_derive;
#[cfg(test)... |
use futures::future::Future;
use std::net::IpAddr;
use std::net::SocketAddr;
use std::pin::Pin;
use std::sync::Arc;
#[derive(PartialEq, Clone)]
pub enum SocketType {
RawIpv4,
RawIpv6,
ICMP,
TCP,
UDP,
}
#[derive(Debug)]
pub enum SocketSendError {
SocketNotReady,
Exhausted,
Unknown(Strin... |
mod DJKey;
use crate::DJKey::DJKey::CamelotKey;
use std::env;
fn main() {
println!("Hello, world!");
let args: Vec<String> = env::args().collect();
// first argument is switch to indicate what type of key we are inputting
// 1. --camelot -c
// 2. --key -k
let switch = &args[1];
// second ... |
use crate::figure::IndexedMesh;
use crate::figure::MeshPoint;
use crate::figure::RegularMesh;
use crate::figure::RenderableMesh;
use gltf::mesh::util::ReadIndices::{U16, U32, U8};
use nalgebra::Vector3;
use nalgebra_glm::cross;
use nalgebra_glm::length;
use nalgebra_glm::normalize;
pub enum LoadingError {
Ooops,
}... |
use crate::search::request::{boost_request::RequestBoostPart, snippet_info::SnippetInfo};
use core::cmp::Ordering;
use ordered_float::OrderedFloat;
/// Internal and External structure for defining the search requests tree.
#[derive(Serialize, Deserialize, Clone, Debug)]
#[serde(rename_all = "lowercase")]
pub enum Sear... |
pub fn run() {
println!("Print Statemet");
println!("Number {}", 1);
//Basic Formatting
println!("{} is from {}", "Rajeevalochan", "Veppampattu");
//Positional Arguments
println!(
"{0} is from {1} and {0} Loves to {2}",
"Rajeevalochan", "Veppampatu", "Code"
);
//Named Arg... |
#![cfg(test)]
use super::*;
use crate::physics::single_chain::test::Parameters;
mod base
{
use super::*;
use rand::Rng;
#[test]
fn init()
{
let parameters = Parameters::default();
let _ = FJC::init(parameters.number_of_links_minimum, parameters.link_length_reference, param... |
#[doc = "Register `JOFR%s` reader"]
pub type R = crate::R<JOFR_SPEC>;
#[doc = "Register `JOFR%s` writer"]
pub type W = crate::W<JOFR_SPEC>;
#[doc = "Field `JOFFSET` reader - Data offset for injected channel x"]
pub type JOFFSET_R = crate::FieldReader<u16>;
#[doc = "Field `JOFFSET` writer - Data offset for injected chan... |
/// An enum to represent all characters in the PauCinHau block.
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)]
pub enum PauCinHau {
/// \u{11ac0}: '𑫀'
LetterPa,
/// \u{11ac1}: '𑫁'
LetterKa,
/// \u{11ac2}: '𑫂'
LetterLa,
/// \u{11ac3}: '𑫃'
LetterMa,
/// \u{11ac4}: '𑫄'
Let... |
use std::f32::consts;
use cgmath::Point3;
use crate::high_level_fighter::HighLevelSubaction;
/// Uses spherical coordinates to represent the cameras location relative to a target.
/// https://en.wikipedia.org/wiki/Spherical_coordinate_system
/// https://threejs.org/docs/#api/en/math/Spherical
pub(crate) struct Camera... |
pub enum Event {
KeyPress,
KeyRelease,
OwnerGrabButton,
ButtonPress,
ButtonRelease,
EnterWindow,
LeaveWindow,
PointerMotion,
PointerMotionHint,
Button1Motion,
Button2Motion,
Button3Motion,
Button4Motion,
Button5Motion,
ButtonMotion,
Exposure,
VisibilityChange,
Struc... |
use proconio::input;
fn main() {
input! {}
unimplemented!();
}
|
#![allow(non_camel_case_types)]
use crate::mbc::rom::Rom;
use crate::mbc::{mbc1::Mbc1, Mbc, MbcError};
use crate::spec::cartridge_header::CartridgeType;
use crate::spec::hardware_registers::{HardwareRegister, HardwareRegisterError, Interrupt};
use crate::spec::memory_region::MemoryRegion;
use std::convert::TryFrom;
us... |
use std::collections::BTreeMap;
use std::io::{self, BufRead};
fn counts(table: &mut BTreeMap<char, u32>, input: &str) -> (bool, bool) {
table.clear();
for ch in input.chars() {
*table.entry(ch).or_insert(0) += 1;
}
let mut has_doubles = false;
let mut has_triples = false;
for count in t... |
#[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::PADREGH {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w m... |
use crate::sender::Sender;
use std::error::Error;
pub struct PrintSender {}
impl Sender for PrintSender {
fn init(&mut self) {
}
fn send(&self, msg: &str) -> Result<(), Box<dyn Error>> {
println!("MSG: {}", msg);
Ok(())
}
fn name(&self) -> &'static str {
"print"
}
} |
#[doc = "Register `HWCFGR` reader"]
pub type R = crate::R<HWCFGR_SPEC>;
#[doc = "Register `HWCFGR` writer"]
pub type W = crate::W<HWCFGR_SPEC>;
#[doc = "Field `ALARMB` reader - ALARMB"]
pub type ALARMB_R = crate::FieldReader;
#[doc = "Field `ALARMB` writer - ALARMB"]
pub type ALARMB_W<'a, REG, const O: u8> = crate::Fie... |
use std::error;
use std::fmt;
#[derive(Debug)]
pub enum AppError {
// Config related
NeedOutputError,
NeedRowsError,
ParseRowsError,
NeedColsError,
ParseColsError,
NeedHeightError,
ParseHeightError,
NeedWidthError,
ParseWidthError,
NeedBackgroundColorError,
ParseBackgrou... |
extern crate time;
use std::time::{Duration, Instant};
use log::error;
use winit::dpi::LogicalSize;
use winit::window::WindowBuilder;
use winit_input_helper::WinitInputHelper;
use winit::event::{Event, VirtualKeyCode};
use winit::event_loop::{ControlFlow, EventLoop};
use pixels::{Error, Pixels, SurfaceTexture};
use s... |
use std::collections::HashMap;
use itertools::Itertools;
pub fn run() {
let system = BagSystem::build_from_rules(include_str!("input.txt"));
let can_contain_shiny_gold = system.count_contains("shiny gold");
let shiny_gold_requires_contain = system.count_required_bags("shiny gold");
println!("Day07 - P... |
use crate::properties;
use serde::Deserialize;
#[derive(Debug, Deserialize)]
pub struct RoundedCorners {
#[serde(rename = "mn")]
pub match_name: String,
#[serde(rename = "nm")]
pub name: String,
#[serde(rename = "r")]
pub radius: properties::EitherValue,
}
|
use x11::xlib::{
Atom as XAtom,
False as XFalse,
XGetWindowProperty,
};
use std::{
os::raw::{
c_int,
c_uchar,
c_ulong,
},
ptr::null_mut,
};
use crate::{
Atom,
Display,
NotSupported,
Window,
};
/// An export of [XGetWindowProperty].
/// Make sure to [x11::... |
// Test parenthesis
fn foo() {
let very_long_variable_name = (a + first + simple + test);
let very_long_variable_name = (a + first + simple + test + AAAAAAAAAAAAA + BBBBBBBBBBBBBBBBBB +
b + c);
}
|
use std::fs::File;
use std::io::{self, Read};
use std::num;
use std::path::Path;
#[derive(Debug)]
enum CustomError {
Io(io::Error), // we could add more meaningful data
Parse(num::ParseIntError),
}
fn file_parse_verbose<P: AsRef<Path>>(file_path: P) -> Result<i32, CustomError> {
let mut file = File::open(... |
#[doc = "Reader of register MMMS_CONN_STATUS"]
pub type R = crate::R<u32, super::MMMS_CONN_STATUS>;
#[doc = "Reader of field `CURR_CONN_INDEX`"]
pub type CURR_CONN_INDEX_R = crate::R<u8, u8>;
#[doc = "Reader of field `CURR_CONN_TYPE`"]
pub type CURR_CONN_TYPE_R = crate::R<bool, bool>;
#[doc = "Reader of field `SN_CURR`... |
/*
* 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
*/
/// LogsExclusion : Represents the index exclusion filter object from configuration API.
#[derive(Clo... |
// Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::schema::ensure_slice_len_eq;
use anyhow::{format_err, Result};
use byteorder::{BigEndian, ReadBytesExt};
use schemadb::{
define_schema,
schema::{KeyCodec, ValueCodec},
DEFAULT_CF_NAME,
};
use sgtypes::ledger_i... |
mod serve;
use serve::api::v1::API;
use serve::authorizer::Authorizer;
use serve::configuration::ConfigWrapper;
use serve::database::DatabaseController;
use serve::emailer::Emailer;
use serve::oauth::Oauth;
use serve::server::Server;
use std::fs;
use std::fs::{File, OpenOptions};
use std::io::Write;
use std::path::Path... |
use crate::scorecard::{DieCountScores, Scorecard};
pub fn score_roll(roll: &Vec<u8>) -> Scorecard{
let mut aces:u8 = 0;
let mut twos:u8 = 0;
let mut threes:u8 = 0;
let mut fours:u8 = 0;
let mut fives:u8 = 0;
let mut sixes:u8 = 0;
let mut die_total:u8 = 0;
let mut sorted_vec ... |
use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};
#[derive(Hash)]
struct SessionData<'a> {
user_name: &'a str,
extra_data: &'a str,
password: &'a str,
}
fn calculate_hash<T: Hash>(t: &T) -> u64 {
let mut s = DefaultHasher::new();
t.hash(&mut s);
s.finish()
}
pub fn... |
// use std::collections::HashMap;
use std::sync::mpsc::{Receiver, RecvTimeoutError, SyncSender};
use std::thread;
use std::time::{Duration, Instant};
use log::*;
use raft::{self, RawNode};
use raft::eraftpb::{ConfChange, ConfState, Entry, EntryType, Message, MessageType};
use raft::storage::MemStorage;
use crate::ser... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.