text stringlengths 8 4.13M |
|---|
// Copyright 2016 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 ... |
extern crate iron;
#[macro_use] extern crate mime;
extern crate router;
extern crate urlencoded;
extern crate math_utils;
use math_utils::gcd;
use iron::prelude::*;
use iron::status;
use router::Router;
use urlencoded::UrlEncodedBody;
use std::fs::File;
use std::io::prelude::*;
use std::str::FromStr;
fn main() {... |
use std::env;
use std::io::{Write};
use std::io::Result as IoResult;
use std::io::{stdout, stderr};
use std::rc::Rc;
use std::cell::RefCell;
use std::iter::Peekable;
use std::slice::Iter;
use std::hash::Hash;
use std::hash::Hasher;
use std::str::FromStr;
use std::process::exit;
#[allow(unused_imports)] #[allow(depreca... |
use anyhow::Result;
use std::str::FromStr;
use tracing::Level;
use tracing_subscriber::FmtSubscriber;
pub fn init<'a>(level: impl Into<Option<&'a str>>) -> Result<()> {
let level = match level.into() {
Some(l) => Level::from_str(l)?,
None => Level::INFO,
};
let subscriber = FmtSubscriber::b... |
pub mod node_type;
pub mod node;
pub mod string_node;
pub mod bind_node;
pub mod choose_node;
pub mod foreach_node;
pub mod if_node;
pub mod include_node;
pub mod otherwise_node;
pub mod trim_node;
pub mod when_node;
pub mod set_node;
pub mod where_node;
pub mod sql_node;
pub mod insert_node;
pub mod update_node;
pub ... |
use crate::{
ray::Ray,
rtweekend::{fmax, fmin},
vec3::Point3,
};
use std::mem::swap;
#[derive(Clone)]
pub struct AABB {
pub _min: Point3,
pub _max: Point3,
}
impl AABB {
pub fn new(mi: Point3, ma: Point3) -> Self {
Self { _min: mi, _max: ma }
}
pub fn surrounding_box(box0: &AAB... |
//! Runtime modules.
use std::{
collections::{BTreeMap, BTreeSet},
fmt::Debug,
};
use impl_trait_for_tuples::impl_for_tuples;
use crate::{
context::{Context, TxContext},
dispatcher, error,
error::Error as _,
event, modules, storage,
storage::{Prefix, Store},
types::{
message::M... |
use std::{
fs::File,
io,
io::{BufRead, BufReader},
};
pub fn find_two_items_that_sum_2020(input: &[u32]) -> Option<(u32, u32)> {
for i in input {
for j in input {
if i + j == 2020 {
return Some((*i, *j));
}
}
}
None
}
pub fn find_three_it... |
pub const MEMORY_SIZE_MAX: usize = std::i16::MAX as usize;
pub const NUM_OF_REGISTERS: usize = 8; |
extern crate bindgen;
fn osx_version() -> Result<String, std::io::Error> {
use std::process::Command;
let output = Command::new("defaults")
.arg("read")
.arg("loginwindow")
.arg("SystemVersionStampAsString")
.output()?
.stdout;
let version_str = std::str::from_utf8(... |
const INPUT: &str = include_str!("../input/2019/day1.txt");
pub fn parse_input() -> Vec<i32> {
INPUT.lines().map(|l| l.parse().unwrap()).collect()
}
pub fn part1() -> i32 {
let input = parse_input();
input.iter().map(|n| (n / 3) - 2).sum()
}
pub fn part2() -> i32 {
let input = parse_input();
let ... |
use crate::{Actor, Addr, Context, Handler, Message, Result, Sender, Service};
use fnv::FnvHasher;
use std::any::Any;
use std::collections::HashMap;
use std::hash::BuildHasherDefault;
use std::marker::PhantomData;
type SubscriptionId = u64;
pub(crate) struct Subscribe<T: Message<Result = ()>> {
pub(crate) id: Subs... |
use std::env;
use std::error::Error;
use std::fs;
use std::str;
type Matrix = Vec<Vec<f64>>;
pub fn kmer_prob(kmer: &[u8], matrix: &Matrix) -> f64 {
let mut prob = 1.;
for (i, nt) in kmer.iter().enumerate() {
let pos = match nt {
b'A' => 0,
b'C' => 1,
b'G' => 2,
... |
use std::fs::{create_dir_all, File};
use std::io::prelude::*;
use std::path::{Path, PathBuf};
use std::thread;
use actix_web::web;
use chrono::offset::Utc;
use indexmap::IndexMap;
use log::{error, info};
use meilisearch_core::{MainWriter, MainReader, UpdateReader};
use meilisearch_core::settings::Settings;
use meilise... |
/*
* 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 PublicipRequestFr... |
//! A Function block is a block containing other blocks. It basically
//! contains a sequence of other blocks to execute one by one.
use super::BasicBlock;
use crate::label::Label;
use std::vec::Vec;
#[derive(Debug)]
pub struct Function<'block> {
label: Label,
args: Option<&'block Vec<&'block dyn BasicBlock... |
/*
* The mythical generator.
*/
use super::{PyCode, PyStrRef, PyType};
use crate::{
class::PyClassImpl,
coroutine::Coro,
frame::FrameRef,
function::OptionalArg,
protocol::PyIterReturn,
types::{Constructor, IterNext, Iterable, Representable, SelfIter, Unconstructible},
AsObject, Context, P... |
use game::*;
use std::collections::HashSet;
impl Damager{
pub fn step(game: &mut Game1){
for damager in game.damagers.iter_mut(){
let mover=game.movers.at(damager.mover_id.id);
let allegiance=game.allegiances.at(damager.allegiance_id.id);
let mut improved_mover=mover.clone();
improved_mover.width+=damag... |
//
// accounts/mod.rs
//
pub mod types;
use self::types::*;
use accounts::types::CurrentUser::*;
use db::{Conn, PooledConnection};
use diesel::prelude::*;
use diesel::result::DatabaseErrorKind;
use diesel::result::Error::DatabaseError;
use result::Error;
use result::{Payload, Response};
use validator::Validate;
///
/... |
use syn::{Ident, Ty, Path, PathSegment};
pub fn ty_ident(ident: Ident) -> Ty {
ty_path(path_ident(ident))
}
pub fn ty_path(path: Path) -> Ty {
Ty::Path(None, path)
}
pub fn path_ident(ident: Ident) -> Path {
Path {
global: false,
segments: vec![PathSegment::ident(ident)],
}
}
|
pub mod response;
use crate::auth::Authenticator;
use crate::utils::options::CommentOption;
use crate::Client;
use async_trait::async_trait;
use crate::error::Error;
use crate::responses::listing::{GenericListing, ListingArray};
pub trait CommentType<'a>: Sized + Sync + Send {
fn get_permalink(&self) -> &String;... |
// 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 ... |
// Copyright (C) 2019 Frank Rehberger
//
// Licensed under the Apache License, Version 2.0 or MIT License
#[cfg(test)]
extern crate test_generator;
#[cfg(test)]
mod tests {
use test_generator::test_resources;
// For all subfolders matching "res/*/input.txt" do generate a test function
// For example:
... |
// 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 agre... |
use geo::algorithm::contains::Contains;
use rustler::types::ListIterator;
use rustler::{Encoder, Env, Error, NifResult, ResourceArc, Term};
mod atoms {
rustler::rustler_atoms! {
atom ok;
//atom error;
atom __true__ = "true";
atom __false__ = "false";
}
}
rustler::rustler_export... |
use gdk::enums::key;
use gdk::DragAction;
use gtk::*;
use url::Url;
use std::ffi::OsStr;
use std::path::PathBuf;
pub fn get_from_treeview_single(treeview: &TreeView, column: Option<i32>) -> Option<PathBuf> {
let selection = treeview.get_selection();
if let Some((model, iter)) = selection.get_selected() {
... |
pub mod into_boxed;
pub mod lazy_option;
pub mod bool_cmpxchg;
pub mod option_overwrite;
|
pub struct Solution;
impl Solution {
pub fn max_sub_array(nums: Vec<i32>) -> i32 {
if nums.len() == 0 {
return 0;
}
let mut max_sum = std::i32::MIN;
let mut cur_sum = 0;
for val in nums {
cur_sum += val;
if cur_sum > max_sum {
... |
#[repr(C)]
{maybe_pub}struct {name}([u8; ::type_sizes::{size_const_name}]);
impl ::cpp_utils::new_uninitialized::NewUninitialized for {name} {{
unsafe fn new_uninitialized() -> {name} {{
{name}(::std::mem::uninitialized())
}}
}}
|
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[link(name = "windows")]
extern "system" {}
pub type CardAddedEventArgs = *mut ::core::ffi::c_void;
pub type CardRemovedEventArgs = *mut ::core::ffi::c_void;
pub type SmartCard = *mut ::core::ffi::c_void;... |
#[cfg(all(not(target_arch = "wasm32"), test))]
mod test;
use liblumen_alloc::erts::term::prelude::Term;
/// `/=/2` infix operator. Unlike `=/=`, converts between floats and integers.
#[native_implemented::function(erlang:/=/2)]
pub fn result(left: Term, right: Term) -> Term {
left.ne(&right).into()
}
|
//! State transition types
use borsh::{BorshDeserialize, BorshSchema, BorshSerialize};
use crate::{
borsh_state::{BorshState, InitBorshState},
error::Error,
};
use solana_program::{
account_info::AccountInfo, entrypoint::ProgramResult, program_error::ProgramError,
program_pack::IsInitialized,
};
struc... |
// MinIO Rust Library for Amazon S3 Compatible Cloud Storage
// Copyright 2022 MinIO, Inc.
//
// 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... |
use crate::database::Database;
use bitflags::_core::fmt::Debug;
use crate::Result;
use crate::types::chrono::NaiveDateTime;
use chrono::Local;
/// Associate [`Database`] with a `RawValue` of a generic lifetime.
///
/// ---
///
/// The upcoming Rust feature, [Generic Associated Types], should obviate
/// the need for t... |
mod mesh;
use std::fs::File;
use glium::{
draw_parameters::DrawParameters, implement_vertex, index, uniform, Display, Frame, Program,
Surface, VertexBuffer,
};
use glium_text::{FontTexture, TextDisplay, TextSystem};
use nalgebra::{Matrix4, Point3, Vector3, Vector4};
use mesh::Mesh;
const VERTEX_SHADER_SRC: ... |
fn main() {
if std::env::var("CARGO_FEATURE_LIBDWARF").is_ok() {
println!("cargo:rustc-link-lib=static=dwarf");
}
if std::env::var("CARGO_FEATURE_ELFUTILS").is_ok() {
println!("cargo:rustc-link-lib=dylib=dw");
}
println!("cargo:rustc-link-lib=dylib=elf");
println!("cargo:rustc-li... |
// Copyright 2020-2021, The Tremor Team
//
// 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 agr... |
use std::time::{Duration, Instant};
fn main() {
let response = String::from("HTTP/1.1 418 I'm a teapot\r\n");
let mut res: (&str, &str, &str) = ("", "", "");
let start = Instant::now();
for _ in 0..100_000_000 {
res = match parse_http(&response) {
Ok(data) => data,
Err(e)... |
#![feature(anonymous_lifetime_in_impl_trait)]
#![feature(box_patterns)]
#![feature(const_trait_impl)]
#![feature(let_chains)]
#![allow(clippy::borrow_interior_mutable_const)]
#![allow(clippy::declare_interior_mutable_const)]
use candy_frontend::{cst::Cst, position::Offset};
use existing_whitespace::{TrailingWithIndent... |
use image::Rgba;
use tiny_fail::Fail;
pub fn get_scale(name: &str) -> Result<Box<dyn ColorScale>, Fail> {
match name {
"color" => Ok(Box::new(Colorful())),
"gray" => Ok(Box::new(Grayscale())),
name => Err(Fail::new(format!("unknown color scale: '{}'", name))),
}
}
pub trait ColorScale ... |
use super::*;
use std::{iter, sync::Arc};
#[allow(unused_imports)]
use core_extensions::SelfOps;
use crate::{
test_utils::{must_panic, ShouldHavePanickedAt},
traits::IntoReprC,
};
#[cfg(feature = "rust_1_64")]
#[test]
fn const_as_slice_test() {
const RV: &RVec<u8> = &RVec::new();
const SLICE: &[u8] ... |
#![no_std]
#![no_main]
// pick a panicking behavior
use panic_halt as _; // you can put a breakpoint on `rust_begin_unwind` to catch panics
use cortex_m_rt::entry;
//semi hosting
use cortex_m_semihosting::hprintln;
#[entry]
fn main() -> ! {
hprintln!("Hello world from logging").unwrap();
loop {
//... |
// 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::*;
use crate::{protocol::response::Response, request_builder::RequestParams};
use failure::Fail;
use futures::future::BoxFuture;
use futures::pr... |
#[doc(hidden)]
#[macro_export]
macro_rules! _sabi_type_layouts {
(internal; $ty:ty )=>{{
$crate::pmr::get_type_layout::<$ty>
}};
(internal; $ty:ty = SABI_OPAQUE_FIELD)=>{
$crate::pmr::__sabi_opaque_field_type_layout::<$ty>
};
(internal; $ty:ty = OPAQUE_FIELD)=>{
$crate::pmr::... |
use nom::branch::alt;
use nom::bytes::complete::tag;
use nom::character::complete::*;
use nom::combinator::*;
use nom::multi::*;
use nom::sequence::*;
use nom::IResult;
use std::collections::HashMap;
fn main() {
let text = std::fs::read_to_string("input").unwrap();
let (mut parser, msgs) = all_consuming(input)... |
#[doc = "Reader of register ACSTAT1"]
pub type R = crate::R<u32, super::ACSTAT1>;
#[doc = "Reader of field `OVAL`"]
pub type OVAL_R = crate::R<bool, bool>;
impl R {
#[doc = "Bit 1 - Comparator Output Value"]
#[inline(always)]
pub fn oval(&self) -> OVAL_R {
OVAL_R::new(((self.bits >> 1) & 0x01) != 0)... |
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::error::Error;
use std::fs::File;
use std::io::BufReader;
use std::time::{SystemTime, UNIX_EPOCH};
use super::messages::{Chat, Message};
use lazy_static::lazy_static;
pub(crate) fn timestamp() -> u64 {
SystemTime::now()
.duration_si... |
use std::collections::HashMap;
use std::time::{Duration, Instant};
use crate::event::NetworkEvent;
use crate::network::PacketHeader;
pub const HIGH_FREQUENCY: u8 = 40;
pub const LOW_FREQUENCY: u8 = 20;
pub const LATENCY_THRESHOLD: f32 = 250.0;
pub const MIN_RECOVERY_COOLDOWN: Duration = Duration::from_secs(1);
pub co... |
use std::sync::Arc;
use super::Backend;
pub trait Fence {
fn value(&self) -> u64;
fn await_value(&self, value: u64);
}
pub struct FenceValuePair<B: Backend> {
pub fence: Arc<B::Fence>,
pub value: u64
}
impl<B: Backend> FenceValuePair<B> {
pub fn is_signalled(&self) -> bool {
self.fence.value() >= self... |
//! Constants for use in connection URLs.
//!
//! Database connections are configured with an instance of [`ConnectParams`](crate::ConnectParams).
//! Instances of [`ConnectParams`](crate::ConnectParams)
//! can be created using a [`ConnectParamsBuilder`](crate::ConnectParamsBuilder), or from a URL.
//!
//! Also [`Conn... |
#[derive(Debug)]
pub struct Register(pub u8);
impl From<Register> for usize {
fn from(reg: Register) -> usize {
let Register(val) = reg;
val as usize
}
}
#[derive(Debug)]
pub enum Value {
Literal(u16),
Register(Register),
}
impl From<u16> for Value {
fn from(raw: u16) -> Self {
... |
//! Asynchronous TLS/SSL streams for Tokio using [Rustls](https://github.com/ctz/rustls).
pub extern crate rustls;
pub extern crate webpki;
extern crate bytes;
extern crate futures;
extern crate iovec;
extern crate tokio_io;
pub mod client;
mod common;
pub mod server;
use common::Stream;
use futures::{Async, Future... |
/// `ALPHA = %x41-5A / %x61-7A ; A-Z / a-z`
pub fn alpha(c: &u8) -> bool {
c >= &b'A' && c <= &b'Z' || c >= &b'a' && c <= &b'z'
}
/// `BIT = "0" / "1"`
pub fn bit(c: &u8) -> bool {
c == &b'0' || c == &b'1'
}
/// `CHAR = %x01-7F ; any 7-bit US-ASCII character, excluding NUL`
pub fn char(c: &u8) -> bool {
... |
extern crate regex;
use regex::Regex;
use crate::util::{
is_curly_brace,
is_escape_char,
is_identifier,
is_number,
is_operator,
is_parenthesis,
is_separator,
is_string_delimiter,
is_terminator,
is_whitespace
};
use super::{Token, TokenType, tokenizer::Tokenizer};
pub fn parse_... |
use std::borrow::Cow;
use std::iter;
use std::ops::{Deref, Range};
use clippy_utils::diagnostics::{span_lint, span_lint_and_sugg, span_lint_and_then};
use clippy_utils::source::{snippet_opt, snippet_with_applicability};
use rustc_ast::ast::{Expr, ExprKind, ImplKind, Item, ItemKind, MacCall, Path, StrLit, StrStyle};
us... |
extern crate gnuplot;
extern crate interp_util;
extern crate la;
use std::f64;
use std::str::FromStr;
use gnuplot::*;
use interp_util::*;
#[derive(Debug)]
struct CubicSection {
c_begin: f64,
c_end: f64,
l_begin: f64,
l_end: f64,
t_begin: f64,
t_end: f64,
}
impl CubicSection {
fn calc(&... |
// use anyhow::{Context, Result};
use anyhow:: Result;
use futures_util::{
SinkExt,
StreamExt,
stream::Stream,
sink::Sink
};
use tokio_tungstenite::{
tungstenite::protocol::Message,
tungstenite::error::Error as WsError
};
use super::settings::{ReaderSettings, WriterSettings};
pub async fn re... |
mod utils;
// in this file we can use #[wasm_bindgen] only because it is brought into scope by the prelude.
use wasm_bindgen::prelude::*;
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
// allocator.
#[cfg(feature = "wee_alloc")]
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_al... |
// originally from https://github.com/mgattozzi/ferris-says/blob/master/src/lib.rs
// ferris-says crate
extern crate smallvec;
use smallvec::*;
use std::iter::repeat;
// Constants! :D
const ENDSL: &[u8] = b"| ";
const ENDSR: &[u8] = b" |\n";
#[cfg(not(feature = "clippy"))]
const FERRIS: &[u8] = br#"
\
... |
#![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 AudioEncodingProperties(pub ::windows::core::I... |
extern crate docopt;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate bincode;
extern crate petgraph;
extern crate rand;
extern crate statrs;
extern crate capngraph;
use docopt::Docopt;
use std::fs::File;
use petgraph::prelude::*;
use std::io::{BufWriter, Write};
#[cfg_attr(rustfmt, rustfmt_sk... |
use csv::Writer;
use std::fs::File;
use crate::between_herd_spread_model::InfectionEvents;
use crate::prelude::*;
#[derive(derive_more::From)]
pub struct BetweenHerdInfectionEventsRecorder(Writer<File>);
/// This is coupled with system [record_between_herd_infection_events].
pub fn setup_between_herd_infection_event... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct COMDLG_FILTERSPEC {
pub pszName: super::super::super::Foundation... |
#![allow(non_snake_case)]
use std::collections::HashMap;
use std::hash::Hash;
pub type OxGetKeyRef<TElem, TKey> = (Fn(&TElem) -> &TKey);
pub struct GroupWithRefs<'a, TKey, TValue>
where
TKey: Eq + Hash,
TKey: 'a,
TValue: 'a
{
key: &'a TKey,
values: Vec<&'a TValue>,
}
pub ... |
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
use std::collections::HashMap;
struct Orbit {
orbited: String,
orbiting: String,
}
impl Orbit {
fn new(orbited: String, orbiting: String) -> Orbit {
return Orbit {
orbited,
orbiting,
};
}
}
struct CelestialBody {
name: String,
parents:... |
///
/// Export public structs
///
pub use self::editor::Editor;
pub use self::database_browser::DatabaseBrowser;
pub use self::header_bar::HeaderBar;
pub use self::result_list::ResultList;
pub use self::main_window::MainWindow;
pub use self::component_store::ComponentStore;
pub use self::traits::ComponentStoreTrai... |
use serenity::framework::standard::Args;
use serenity::{
framework::standard::{
macros::{command, group},
CommandResult,
},
model::channel::Message,
prelude::*,
};
use crate::bot::utils::Utils;
use crate::extensions::context::ClientContextExt;
use serenity::model::prelude::ReactionType... |
use crate::database;
use crate::todo::Todo;
pub fn add(description: String, db_filename: &str) {
let mut db = database::read(db_filename);
db.todos.push( Todo {
title: description.clone(),
done: false
});
database::save(&db, db_filename);
println!("\"{}\" added \u{2714}", descripti... |
//! CLI tests for the compile subcommand.
use anyhow::{bail, Context};
use std::env;
use std::fs;
use std::io::Write;
use std::path::{Path, PathBuf};
use std::process::Command;
const CLI_INTEGRATION_TESTS_ASSETS: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/assets");
const OBJECT_FILE_ENGINE_TEST_C_SOURCE: &[u8] =
... |
extern crate cc;
extern crate which;
use std::env;
use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};
const ENV_LLVM_PREFIX: &'static str = "LLVM_PREFIX";
const ENV_LLVM_BUILD_STATIC: &'static str = "LLVM_BUILD_STATIC";
const ENV_LLVM_LINK_LLVM_DYLIB: &'static str = "LLVM_LINK_LLVM_DYLIB";
const ENV_... |
use trayicon::*;
use std::sync::mpsc::{ Receiver };
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
pub enum Events {
Click,
ShowOnlineInfo,
About,
Exit,
}
/// 트레이 아이콘 생성.
pub fn new() -> (TrayIcon<Events>, Receiver<Events>) {
let (s, r) = std::sync::mpsc::channel::<Events>();
let icon_bytes = include_bytes!("ribb... |
#[doc = "Reader of register DMARIS"]
pub type R = crate::R<u32, super::DMARIS>;
#[doc = "Writer for register DMARIS"]
pub type W = crate::W<u32, super::DMARIS>;
#[doc = "Register DMARIS `reset()`'s with value 0"]
impl crate::ResetValue for super::DMARIS {
type Type = u32;
#[inline(always)]
fn reset_value() ... |
use crate::ast;
use crate::{Spanned, ToTokens};
/// A return statement `<expr>.await`.
///
/// # Examples
///
/// ```rust
/// use rune::{testing, ast};
///
/// testing::roundtrip::<ast::Expr>("(42).await");
/// testing::roundtrip::<ast::Expr>("self.await");
/// testing::roundtrip::<ast::Expr>("test.await");
/// ```
#[... |
use super::{BlockTimestamp, TimePointSec};
use crate::bytes::{NumBytes, Read, Write};
use core::convert::{TryFrom, TryInto};
use core::fmt;
use core::num::TryFromIntError;
/// High resolution time point in microseconds
/// <https://github.com/EOSIO/eosio.cdt/blob/4985359a30da1f883418b7133593f835927b8046/libraries/eosi... |
// Based on t-1.xsd
// targetNamespace = "http://docs.oasis-open.org/wsn/t-1"
// xmlns:xsd="http://www.w3.org/2001/XMLSchema"
// xmlns:wstop = "http://docs.oasis-open.org/wsn/t-1"
use std::io::{Read, Write};
use yaserde::{YaDeserialize, YaSerialize};
|
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
use std::marker;
struct Invariant<'a> {
marker: marker::PhantomData<*mut &'a()>
}
fn to_same_lifetime<'r>(b_isize: Invariant<'r>) {
let bj: Invariant<'r> = b_isize;
}
fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) ->... |
#[doc = "Reader of register CFGR"]
pub type R = crate::R<u32, super::CFGR>;
#[doc = "Writer for register CFGR"]
pub type W = crate::W<u32, super::CFGR>;
#[doc = "Register CFGR `reset()`'s with value 0"]
impl crate::ResetValue for super::CFGR {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Typ... |
use libc::c_uint;
use curses;
bitflags! {
flags Attributes: c_uint {
const NORMAL = curses::A_NORMAL,
const COLOR = curses::A_COLOR,
const STANDOUT = curses::A_STANDOUT,
const UNDERLINE = curses::A_UNDERLINE,
const REVERSE = curses::A_REVERSE,
const BLINK ... |
pub mod hlayout;
pub mod layout;
pub mod str_layout;
pub mod vlayout;
|
/*
Copyright (c) 2015, 2016 Saurav Sachidanand
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 Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, di... |
use std::{
convert::TryInto,
array::TryFromSliceError,
};
const MAGIC_HEADER_STRING: [u8; 16] = [
0x53, 0x51, 0x4c, 0x69, 0x74, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x20, 0x33, 0x00
];
fn main() -> Result<(), Box<dyn std::error::Error>> {
let contents = std::fs::read("data.sqlite")?;
a... |
//! This module implements the `table` CLI command
use influxdb_iox_client::connection::Connection;
use observability_deps::tracing::info;
use thiserror::Error;
mod create;
#[allow(clippy::enum_variant_names)]
#[derive(Debug, Error)]
pub enum Error {
#[error("JSON Serialization error: {0}")]
Serde(#[from] se... |
use crate::{
convert::{ToPyObject, TryFromObject},
object::{AsObject, PyObjectRef, PyResult},
VirtualMachine,
};
#[derive(result_like::OptionLike)]
pub enum PyArithmeticValue<T> {
Implemented(T),
NotImplemented,
}
impl PyArithmeticValue<PyObjectRef> {
pub fn from_object(vm: &VirtualMachine, ob... |
extern crate bulletproofs;
extern crate curve25519_dalek;
extern crate merlin;
extern crate rand;
extern crate subtle;
#[macro_use]
extern crate failure;
mod error;
mod gadgets;
mod spacesuit;
mod value;
pub use error::SpacesuitError;
pub use spacesuit::*;
pub use value::*;
|
// Copyright 2019 Liebi Technologies.
// This file is part of Bifrost.
// Bifrost is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
... |
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors.
//
// 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 ... |
// Copyright 2021 Chiral Ltd.
// Licensed under the Apache-2.0 license (https://opensource.org/licenses/Apache-2.0)
// This file may not be copied, modified, or distributed
// except according to those terms.
use crate::core;
use crate::core::graph::*;
use super::atom;
/// Seperate vertices in an orbit according to t... |
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
fn foo(&mut (ref mut v, w): &mut (&u8, &u8), x: &u8) {
*v = x;
//[base]~^ ERROR lifetime mismatch
//[nll]~^^ ERROR lifetime may not live long enough
}
fn main() { }
|
use constants::*;
/// Calculates the number of pieces required to hold this many bits in a genestring.
pub fn part_count_for_bits(bits: u64) -> u64 {
if bits == 0 {
1
} else if bits % PIECE_SIZE_IN_BITS == 0 {
bits / PIECE_SIZE_IN_BITS
} else {
(bits / PIECE_SIZE_IN_BITS) + 1
}
... |
use std::fs;
use regex::Regex;
use std::collections::HashMap;
fn valid_part_1 (passport: &HashMap<String,String>) -> bool {
if !passport.contains_key("byr") {
return false;
}
if !passport.contains_key("iyr") {
return false;
}
if !passport.contains_key("ey... |
use std::fs;
#[test]
fn validate() {
assert_eq!(algorithm("src/day_3/input_test.txt", false), 336);
}
fn algorithm(file_location: &str, print_results: bool) -> u64 {
let contents = fs::read_to_string(file_location).unwrap();
let values: Vec<&str> = contents.lines().collect();
let max_cols = values.fir... |
pub fn p2(max: u32) -> u32 {
rec_while(
(1, 2, 0),
|&(c, n, t)| { (n, c + n, if c & 1 == 0 { t + c} else { t } ) },
|&(c, _, _)| { c <= max }
).2
}
fn rec_while<T, F, P>(x: T, next: F, pred: P) -> T
where F: Fn(&T) -> T,
P: Fn(&T) -> bool,
{
if pred(&x) { rec_while(next(&x),... |
#[test]
fn iterator_sum_consumer_test() {
let s: u32 = (1..20 + 1).sum();
assert_eq!(s, 210);
}
#[test]
fn iterator_factorial_consumer_test() {
let s: u32 = (1..5 + 1).product();
assert_eq!(s, 120);
}
#[test]
fn max_min_consumer_test() {
assert_eq!([0, 30, 12, 200, 67, 40].iter().max(), Some(&200)... |
// 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 ... |
pub(crate) mod process;
pub mod recipe;
// mod state_machine;
pub use recipe::Recipe;
/// Redefine BeerXML types as Bryggio types.
/// This is for future convenience
/// If the original BeerXML types are ever replaced with custom Bryggio types,
/// then only the definitions below need to change and the entire code bas... |
#![allow(unused)]
#![allow(non_snake_case)]
use std::fmt; //fmt METHOD
use serde::{Deserialize, Serialize};
// Universal flags can apply to any transaction type
#[derive(Serialize, Deserialize, Debug)]
pub enum Universal {
FullyCanonicalSig = 0x80000000
}
#[derive(Serialize, Deserialize, Debug)]
pub enum Account... |
pub mod support;
pub mod api; |
use game_core::loading::RequiredAssetLoader;
use game_lib::bevy::{
prelude::*,
reflect::TypeUuid,
render::{pipeline::PipelineDescriptor, shader::ShaderStages},
};
pub const REGION_PIPELINE_HANDLE: HandleUntyped =
HandleUntyped::weak_from_u64(PipelineDescriptor::TYPE_UUID, 0x5BA3E190095C409A);
pub const... |
mod gifcard;
pub use gifcard::gifcard;
mod navbar;
pub use navbar::navbar;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.