text stringlengths 8 4.13M |
|---|
use std::{fs::File, io::BufReader};
use dicom_core::value::Value;
use dicom_encoding::text::SpecificCharacterSet;
use dicom_object::{mem::InMemDicomObject, open_file};
use dicom_test_files;
#[test]
fn test_ob_value_with_unknown_length() {
let path =
dicom_test_files::path("pydicom/JPEG2000.dcm").expect("t... |
use std::{
fs::{File, remove_dir_all},
io::{Read},
path::{PathBuf, Path}
};
use toml;
use walkdir::WalkDir;
use meta::Meta;
use image::Image;
use state::error::StateError;
#[derive(Serialize, Deserialize, Debug, Default, Clone, Eq, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct Project {
p... |
pub mod lexer {
use crate::{Token, TokenType};
use std::ops::{Deref, DerefMut};
use crate::*;
#[derive(Debug)]
pub struct Buffer(String);
impl Buffer {
pub fn new() -> Self {
Self(String::new())
}
pub fn is_string(&self) -> bool {
self.0.starts... |
#[doc = "Register `SWIER2` reader"]
pub type R = crate::R<SWIER2_SPEC>;
#[doc = "Register `SWIER2` writer"]
pub type W = crate::W<SWIER2_SPEC>;
#[doc = "Field `SWI50` reader - Software interrupt on event x When EXTI_PRIVCFGR.PRIVx is disabled, SWIx can be accessed with unprivileged and privileged access. When EXTI_PRIV... |
use crate::component::Component;
use crate::AsTable;
use clap::{App, AppSettings, ArgMatches};
use digitalocean::prelude::*;
use failure::Error;
use prettytable::Cell;
use prettytable::Row;
use prettytable::{self, Table};
mod list;
pub use self::list::List;
mod get;
pub use self::get::Get;
mod create;
pub use self::... |
fn main() {
println!("Config path: {:?}", pahkat_client::defaults::config_path());
println!("Tmp path: {:?}", pahkat_client::defaults::tmp_dir());
println!("Cache path: {:?}", pahkat_client::defaults::cache_dir());
println!("\n==As root:==");
println!(
"Config path: {:?}",
pathos::s... |
use chrono::{DateTime, Utc};
use structopt::StructOpt;
use uuid::Uuid;
#[derive(Debug, StructOpt)]
pub struct Command {
art_id: Uuid,
activate_at: DateTime<Utc>,
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct ReqBody {
art_id: Uuid,
activate_at: DateTime<Utc>,
}
pub async fn execute... |
use std::fs;
use std::io::Write;
const TRANSPARENCY_THRESHOLD: u8 = 100;
const SIZE_FACTOR: u32 = 10;
#[allow(unused_must_use)]
fn main() {
let in_img = image::open("in.png").unwrap().to_rgba8();
let (width, height) = in_img.dimensions();
let header = fs::read_to_string("header.svg").unwrap()
.re... |
#![deny(unsafe_op_in_unsafe_fn)]
use crate::alloc::{GlobalAlloc, Layout, System};
use crate::ptr;
use crate::sys_common::alloc::{realloc_fallback, MIN_ALIGN};
// SAFETY: All methods implemented follow the contract rules defined
// in `GlobalAlloc`.
#[stable(feature = "alloc_system_type", since = "1.28.0")]
unsafe imp... |
use super::*;
use math::*;
pub struct SliderModel {
pub current: f32,
pub min: f32,
pub max: f32,
}
impl SliderModel {
pub fn set_percent(&mut self, value: f32) {
self.current = lerp(self.min, self.max, value);
}
pub fn percent(&mut self) -> f32 {
clamp01((self.current - self.m... |
use crate::models::{ComicId, ComicIdInvalidity, ItemId, ItemIdInvalidity, Token};
use crate::util::{ensure_is_authorized, ensure_is_valid};
use actix_web::{error, web, HttpResponse, Result};
use actix_web_grants::permissions::AuthDetails;
use anyhow::anyhow;
use database::models::{
Comic as DatabaseComic, Item as D... |
use std::fs::File;
use std::io::prelude::*;
fn main() {
let filename = "input.txt";
println!("In file {}", filename);
let mut f = File::open(filename).expect("file not found");
let mut contents = String::new();
f.read_to_string(&mut contents)
.expect("something went wrong reading the file... |
//! Contains a set of commonly used behavior tree nodes.
mod sequence;
pub use self::sequence::{ActiveSequence, Sequence};
mod selector;
pub use self::selector::{Selector, StatefulSelector};
mod parallel;
pub use self::parallel::Parallel;
mod decorator;
pub use self::decorator::{Decorator, Invert, Repeat, UntilFail... |
use anyhow::*;
use futures::channel::mpsc::{UnboundedReceiver, UnboundedSender};
use futures::lock::Mutex;
use futures::stream::StreamExt;
use libra_crypto::HashValue;
use libra_logger::prelude::*;
use libra_types::account_address::AccountAddress;
use sgtypes::system_event::Event;
use std::collections::HashMap;
use std... |
#[macro_export]
macro_rules! yield_all {
($gen: expr) => {{
use std::ops::{Generator, GeneratorState};
use std::pin::Pin;
let mut gen = $gen;
loop {
match Pin::new(&mut gen).resume(()) {
GeneratorState::Yielded(yielded) => {
yield yiel... |
use regex::Regex;
use std::collections::HashMap;
use std::collections::HashSet;
use std::io::{self};
#[derive(Debug, Clone)]
struct Range {
lower_min: usize,
lower_max: usize,
upper_min: usize,
upper_max: usize,
}
impl Range {
fn in_range(&self, number: usize) -> bool {
(self.lower_min <= ... |
#[doc = "Register `FDCAN_XIDFC` reader"]
pub type R = crate::R<FDCAN_XIDFC_SPEC>;
#[doc = "Register `FDCAN_XIDFC` writer"]
pub type W = crate::W<FDCAN_XIDFC_SPEC>;
#[doc = "Field `FLESA` reader - Filter List Standard Start Address"]
pub type FLESA_R = crate::FieldReader<u16>;
#[doc = "Field `FLESA` writer - Filter List... |
#[doc = "Register `ECCCORR` reader"]
pub type R = crate::R<ECCCORR_SPEC>;
#[doc = "Register `ECCCORR` writer"]
pub type W = crate::W<ECCCORR_SPEC>;
#[doc = "Field `ADDR_ECC` reader - ECC error address When an ECC error occurs (for single correction) during a read operation, the ADDR_ECC contains the address that genera... |
//! #Art
//!
//! A library for modeling artistic concepts
pub use kinds::PrimaryColor;
pub use kinds::SecondaryColor;
pub use utils::mix;
pub mod kinds {
/// the primary colors according to the RYB color model.
pub enum PrimaryColor {
Red,
Yellow,
Blue,
}
/// The secondary col... |
use crate::context_handle::PtrWrap;
use crate::enums::CapStyle;
use crate::{
AsRaw, AsRawMut, ContextHandle, ContextHandling, ContextInteractions, Error, GResult, JoinStyle,
};
use geos_sys::*;
use std::sync::Arc;
/// Contains the parameters which describe how a [Geometry](crate::Geometry) buffer should be constr... |
pub mod utils {
mod macros;
}
pub mod input {
mod formatter;
mod iterator;
mod source;
pub use self::formatter::*;
pub use self::iterator::*;
pub use self::source::*;
}
pub mod errors {
mod format;
mod sort;
mod source;
pub use self::format::*;
pub use self::sort::*;
... |
use eyre::{eyre, Result};
use serde::{Deserialize, Serialize};
use std::fs;
use std::{borrow::Cow, collections::HashSet};
use tera::Context;
use yaml_front_matter::{Document, YamlFrontMatter};
use crate::{
item::Item, item::RenderContext, item::TeraItem, markdown::find_markdown_files,
markdown::markdown_to_htm... |
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not u... |
use failure::bail;
use failure::format_err;
use failure::Error;
use std::convert::TryFrom;
use std::ops::Deref;
pub trait AtCollection<T>
where
Self: Sized,
{
fn as_slice(&self) -> &[T];
fn as_vec(self) -> Vec<T>;
fn into_iter(self) -> std::vec::IntoIter<T> {
self.as_vec().into_iter()
}
... |
use byteorder::{ByteOrder, LittleEndian};
use bytes::{BufMut, BytesMut, IntoBuf};
use std::io;
use tokio_io::codec::{Decoder, Encoder};
pub mod types;
pub use self::types::*;
use actix::Message;
#[derive(Debug, Clone)]
pub enum AdsPacket {
WriteReq(AmsTcpHeader<types::AdsWriteReq>),
WriteRes(AmsTcpHeader<types... |
pub fn a() {
println!("I'm a line2");
println!("I'm a line3");
println!("I'm a line4");
}
|
// Copyright 2016 Taku Fukushima. All Rights Reserved.
//
// 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 applic... |
extern crate rand;
use crate::common::did::DidValue;
use crate::ledger::constants;
use crate::ledger::identifiers::rich_schema::RichSchemaId;
use crate::tests::utils::constants::{TRUSTEE_DID, TRUSTEE_DID_FQ};
use crate::tests::utils::helpers;
use crate::tests::utils::pool::*;
use rand::Rng;
#[cfg(test)]
mod builder {
... |
extern crate theca;
use theca::{ThecaItem};
use theca::lineformat::{LineFormat};
struct LineTest {
input_notes: Vec<ThecaItem>,
condensed: bool,
search: bool,
expected_format: LineFormat
}
fn test_formatter(tests: &[LineTest]) {
for t in tests.iter() {
let wrapped_format = LineFormat::new... |
#![allow(non_snake_case)]
#![allow(unused_imports)]
#![allow(dead_code)]
use std::fs;
use std::path::Path;
use std::fs::File;
use std::io::BufWriter;
use std::borrow::Cow;
use png::*;
use indicatif::ProgressBar;
use indicatif::ProgressStyle;
use threadpool::ThreadPool;
use std::sync::mpsc::{Sender, Receiver};
use std:... |
// https://www.codewars.com/kata/593c9175933500f33400003e
fn multiples(m: i32, n: f64) -> Vec<f64> {
(1..=m).map(|i| i as f64 * n).collect()
}
fn main(){
assert_eq!(multiples(3, 5.0), vec![5.0, 10.0, 15.0]);
assert_eq!(multiples(5, -1.0), vec![-1.0, -2.0, -3.0, -4.0, -5.0]);
assert_eq!(multiples(1, 3... |
pub mod board;
pub mod enums;
pub mod AI; |
use wasmer::Store;
/// New fresh `Store`.
#[cfg(feature = "default-cranelift")]
#[must_use]
pub fn new_store() -> Store {
use wasmer::{Cranelift, Universal};
let engine = Universal::new(Cranelift::default()).engine();
Store::new(&engine)
}
/// New fresh `Store`.
#[cfg(feature = "default-singlepass")]
#[m... |
//reexport Timestamp, so other modules don't need to use stderrlog
pub use stderrlog::Timestamp;
#[derive(Debug)]
pub struct Settings {
pub verbosity: usize,
pub quiet: bool,
pub timestamp: Timestamp,
pub module_path: Option<String>,
}
impl Default for Settings {
fn default() -> Settings {
... |
mod display_message;
mod set_respawn_timer;
mod update_score;
pub use self::display_message::DisplayMessage;
pub use self::set_respawn_timer::SetRespawnTimer;
pub use self::update_score::UpdateScore;
|
pub struct Cell {
pub state: i32,
}
impl Cell {
pub fn to_string(&self) -> String {
(if self.state == 0 { "." } else { "O" }).to_string()
}
pub fn next_state(&self, neighbours: i32) -> i32 {
if self.state == 1 {
if neighbours == 2 || neighbours == 3 {
1
... |
#[derive(Debug, PartialEq, Eq, Deserialize, Clone)]
pub struct LinkStatus {
pub status: String,
pub link: String, // URL
}
#[derive(Debug, PartialEq, Eq, Deserialize, Clone)]
pub struct ScreenNameInfo {
#[serde(rename="type")]
pub kind: String,
pub object_id: Id,
}
|
pub struct MFCC {
n_mfcc: u32,
n_fft: u32,
stride: u32,
n_mels: u32
}
impl MFCC {
pub fn new(n_mfcc: u32, n_fft: u32, stride: u32, n_mels: u32) -> MFCC {
MFCC {
n_mfcc,
n_fft,
stride,
n_mels
}
}
pub fn transform(v :&Vec<i16>... |
use crate::{
i8080::{error::EmulateError, Result, I8080, Register},
instruction::{InstructionData, Opcode},
io::IO,
};
impl I8080 {
pub(crate) fn out<U: IO>(&mut self, data: InstructionData, io: &mut U) -> Result<()> {
if let Some(port) = data.first() {
io.write_port(port, self.a);
... |
fn main() {
println!("Hello, world!")
tuples();
structs();
tuple_structs_new_types();
enums();
}
fn tuples() {
let x = (1i, "hello");
let x2: (int, &str) = (1, "hello");
println!("{}", x);
println!("{}", x2);
let (a, b, c) = (1i, 2i, 3i); // Pattern matching
println!("a is {}... |
use async_trait::async_trait;
use futures_util::{
future::{self, Either},
stream::StreamExt,
};
use mpsc::{Receiver, Sender, UnboundedReceiver, UnboundedSender};
use tokio::sync::mpsc;
use tracing::{error, info};
use mqtt3::{
proto::{Publication, QoS},
PublishHandle, ReceivedPublication,
};
use trc_cli... |
use syn::{
parse_quote, punctuated::Punctuated, token::Comma, visit_mut::VisitMut, Lit, Meta, NestedMeta,
};
fn parse_features(features: &NestedMeta) -> Vec<String> {
let lit = match features {
NestedMeta::Lit(lit) => lit,
_ => unimplemented!(),
};
let s = match lit {
Lit::Str(s... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Timerx Control Register"]
pub timecr: TIMECR,
#[doc = "0x04 - Timerx Interrupt Status Register"]
pub timeisr: TIMEISR,
#[doc = "0x08 - Timerx Interrupt Clear Register"]
pub timeicr: TIMEICR,
#[doc = "0x0c - TIMx... |
pub struct Request {
pub method: String,
pub path: String,
}
impl Request {}
|
use ring::constant_time::verify_slices_are_equal;
use ring::{hmac, signature};
use crate::algorithms::Algorithm;
use crate::decoding::{DecodingKey, DecodingKeyKind};
use crate::encoding::EncodingKey;
use crate::errors::Result;
use crate::serialization::{b64_decode, b64_encode};
pub(crate) mod ecdsa;
pub(crate) mod ed... |
#![doc = "generated by AutoRust 0.1.0"]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(unused_imports)]
use super::{models, API_VERSION};
#[non_exhaustive]
#[derive(Debug, thiserror :: Error)]
#[allow(non_camel_case_types)]
pub enum Error {
#[error(transparent)]
RoleAssignments_CheckPrincipalAccess(... |
static FILENAME: &str = "input/data";
fn main() {
let data = std::fs::read_to_string(FILENAME).expect("could not read file");
println!("part one: {}", part_one(&data));
}
fn part_one(data: &str) -> usize {
let pub_key_door = data.lines().next().unwrap().parse::<usize>().unwrap();
let pub_key_card = da... |
use log::info;
use std::fs::remove_dir_all;
use std::fs::remove_file;
use std::fs::create_dir_all;
use std::io;
use std::path::Path;
pub fn ensure_clean_dir<P>(dir_path: P) where P: AsRef<Path> {
let path = dir_path.as_ref();
match remove_dir_all(path) {
Ok(_) => info!("removed dir: {}", path.display(... |
use crate::{
assets::level::{LevelAsset, LevelData, LevelObject},
components::{animal_kind::AnimalKind, item_kind::ItemKind},
states::menu::MenuState,
ui::screens::gui::{GuiProps, GuiRemoteProps},
};
use oxygengine::{prelude::*, user_interface::raui::core::widget::WidgetId};
use std::str::FromStr;
cons... |
use crate::html::{Attribute, EventListener, EventToMessage};
use std::default::Default;
pub fn on_click<Msg: Clone + 'static>(message: Msg) -> Attribute<Msg> {
Attribute::Event(EventListener {
type_: "click".to_owned(),
to_message: EventToMessage::StaticMsg(message),
stop_propagation: false... |
use tokio::sync::{mpsc, Mutex};
use std::{io, error::Error, net::SocketAddr};
use tokio::net::TcpStream;
use super::super::utils::{Rx, Tx, Shared};
use std::sync::Arc;
use tokio_util::codec::{Framed, LinesCodec};
pub struct Peer {
name: String,
pswd: String,
lines: Framed<TcpStream, LinesCodec>,
pub rx... |
#[macro_use]
mod macros;
#[derive(Parser)]
#[grammar = "parser/att.pest"]
pub struct Parser;
// impl AsmParser for AttParser {
// fn parse_asm(s: &str) -> AsmProgram<'_> {
// AttParser::parse(Rule::program, s)
// .map(|pairs| {
// pairs
// .into_iter()
// ... |
use std::collections::HashMap;
use nu_ansi_term::Style;
use nu_protocol::{Config, FooterMode, TrimStrategy};
use tabled::{
builder::Builder,
formatting_settings::AlignmentStrategy,
object::{Cell, Columns, Rows, Segment},
papergrid,
style::Color,
Alignment, AlignmentHorizontal, Modify, ModifyObj... |
//! rust-saber allows writing mods for the Oculus Quest version of Beat Saber in
//! Rust.
//!
//! # Examples
//! ```rust,no_run
//! #[repr(C)]
//! #[derive(Default)]
//! pub struct Color {
//! pub r: f32,
//! pub g: f32,
//! pub b: f32,
//! pub a: f32,
//! }
//!
//! #[rust_saber::hook(0x12DC59C, "examp... |
use std::path::PathBuf;
use chrono::{DateTime, NaiveTime, Utc};
use include_dir::File;
use markdown::{
mdast::{Node, Root},
to_mdast, ParseOptions,
};
use miette::{Context, IntoDiagnostic, Result};
use serde::Deserialize;
use crate::{
http_server::pages::blog::md::{IntoHtml, IntoPlainText},
AppState,
... |
pub mod caves;
pub mod cities;
pub mod misc;
pub mod routes;
use std::collections::HashMap;
#[derive(Clone)]
pub struct Location<'a> {
boundaries: Vec<Coordinates>,
entries: HashMap<u8, Coordinates>,
pub motto: Option<&'a str>,
pub name: Option<&'a str>,
portals: HashMap<Coordinates, Portal>,
... |
////// chapter 3 "using functions and control structures"
////// program section:
////// main function
//
fn main() {
let dead = false;
let health = 48;
if dead {
println!("game over!");
return;
} else {
println!("prepare to fight!");
}
if health >= 50 {
println!(... |
use core::fmt::Debug;
use downcast_rs::{Downcast, impl_downcast};
use crate::types::{Vec3, Mat3, EntityHandle};
/// A way to quickly determine collider type.
#[derive(PartialEq, Eq)]
pub enum ColliderType {
/// For the [crate::NullCollider].
NULL,
/// For the [crate::SphereCollider].
SPHERE,
/// For the [crate:... |
use super::Messages;
use common::async_trait::async_trait;
use models::{server::UdpTuple, transport::TransportMsg};
use sip_server::{Error, SipManager, TransportLayer};
use std::any::Any;
use std::sync::{Arc, Weak};
use tokio::sync::Mutex;
#[derive(Debug)]
pub struct TransportSnitch {
sip_manager: Weak<SipManager>... |
#[doc = "Reader of register RXOICR"]
pub type R = crate::R<u32, super::RXOICR>;
#[doc = "Reader of field `RXOICR`"]
pub type RXOICR_R = crate::R<bool, bool>;
impl R {
#[doc = "Bit 0 - Clear-on-read receive FIFO overflow interrupt"]
#[inline(always)]
pub fn rxoicr(&self) -> RXOICR_R {
RXOICR_R::new((... |
/**
All Windows C API Interface Binding Here.
**/
/**
<summary>Cursor Functions</summary>
**/
pub mod Cursor;
/**
<summary>Device Context Functions</summary>
**/
pub mod DeviceContext;
/**
<summary>Dialog Box Functions</summary>
**/
pub mod DialogBox;
/**
<summary>Dynamic-Link Library Functions<... |
use {
crate::Error,
std::{convert::TryFrom, fmt},
};
#[derive(Clone, Debug, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct Schema<'a> {
pub items: Vec<Item<'a>>,
}
#[derive(Clone, Debug, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub enum Item<'a> {
Enum(Enum<'a>),
Table(Table<'a>),
}
#[derive(Clo... |
use super::Filter;
use crate::economy::Monetary;
use binance_async::model::OrderRequest;
pub struct PriceFilter {
min_price: Monetary,
max_price: Monetary,
tick_size: Monetary
}
impl Filter for PriceFilter {
fn apply(&self, mut input: OrderRequest) -> Result<OrderRequest, ()> {
if input.price ... |
// TODO: Are we able to convert Html<A> to Html<B>?
use std::any::Any;
use std::cell::RefCell;
use std::cmp::PartialEq;
use std::fmt::{self, Debug};
use std::rc::Rc;
#[derive(Clone, Debug)]
pub struct HtmlTag<Msg> {
pub tag: String,
pub attrs: Vec<Attribute<Msg>>,
pub children: Vec<Html<Msg>>,
}
impl<Msg... |
//! Responsible for drawing all graphics to the window.
use graphics::character::CharacterCache;
use graphics::color::hex;
use graphics::types::Color;
use graphics::{Context, Graphics};
use rand::seq::SliceRandom;
use crate::common::{
ButtonInteraction, Cell, BOARD_SIZE, DIMENSIONS_CHOICES, IMAGE_NAMES, IMAGE_PRE... |
impl Solution {
pub fn title_to_number(column_title: String) -> i32 {
let (mut res,mut n) = (0,column_title.len());
for i in 0..n{
res = res * 26 + (column_title.as_bytes()[i] - b'A' + 1) as i32;
}
res
}
} |
extern crate openssl;
extern crate base64;
extern crate hex;
mod hex_to_base64;
mod fixed_xor;
mod single_byte_xor_cipher;
mod repeating_key_xor;
#[cfg(test)]
mod challenges {
mod set_1 {
use base64;
use openssl;
use hex;
use hex_to_base64::hex_to_base64;
use fixed_xor::f... |
use crate::util;
use std::u8::MAX as U8_MAX;
pub fn is_valid_password(candidate: u32, range_start: u32, range_end: u32) -> bool {
let num_digits = util::number_of_digits(candidate as f64) as u32;
assert!(num_digits == 6);
assert!(candidate >= range_start && candidate <= range_end);
let mut successful_... |
use bellman::{gadgets::Assignment, groth16, Circuit, ConstraintSystem, SynthesisError};
use bls12_381::Bls12;
use bls12_381::Scalar;
use ff::{Field, PrimeField};
use rand::rngs::OsRng;
use std::ops::{AddAssign, MulAssign, SubAssign};
use std::time::Instant;
use crate::error::Result;
pub struct ZKVirtualMachine {
... |
#[macro_export]
macro_rules! switch {
($exp:expr, [$($template:tt)*] => $action:expr) => {
switch!($exp, [$($template)*] => $action,)
};
($exp:expr, [$($template:tt)*] => $action:expr,) => {
scheme_match!($exp, {$action}, $($template)*)
.expect("Last clause in switch must never ... |
use crate::common::error::VdrResult;
use crate::ledger::{PreparedRequest, RequestBuilder};
use crate::pool::handlers::{handle_consensus_request, handle_full_request, NodeReplies};
use crate::pool::{Pool, PoolBuilder, PoolTransactions, RequestResult, SharedPool};
use crate::utils::test::GenesisTransactions;
use futures:... |
//! Camera focus implementation.
use arctk::{
access,
geom::{Orient, Ray},
math::{Dir3, Pos3},
};
/// Focus structure.
#[derive(Debug)]
pub struct Focus {
/// Orientation.
orient: Orient,
/// Target point.
tar: Pos3,
}
impl Focus {
access!(orient, orient_mut, Orient);
access!(tar,... |
use crate::bot::dialogs::{Dialog, Subscribe, Unsubscribe};
use crate::db::client::DbClient;
use crate::reddit::client::RedditClient;
use crate::telegram::client::TelegramClient;
use crate::telegram::types::Message;
use diesel::result::DatabaseErrorKind;
use diesel::result::Error::DatabaseError;
const HELP_TEXT: &str =... |
use errors::*;
use Parameters;
use tfdeploy::analyser::Analyser;
/// Handles the `prune` subcommand.
#[allow(dead_code)]
pub fn handle(params: Parameters) -> Result<()> {
let model = params.tfd_model;
let output = model.get_node_by_id(params.output_node_id)?.id;
info!("Starting the analysis.");
let ... |
use std::collections::HashMap;
use arrayvec::ArrayVec;
use quick_error::quick_error;
use scroll::{Pread, Pwrite};
use crate::{
inode::{Inode, InodeIoError, InodeRaw, BASE_INODE_SIZE},
superblock::RequiredFeatureFlags,
Filesystem,
};
pub const MAGIC: u32 = 0xEA02_0000;
pub const INLINE_HEADER_SIZE: usize ... |
#![cfg_attr(not(feature = "std"), no_std)]
use liquid::storage;
use liquid_lang as liquid;
use liquid_lang::InOut;
use liquid_prelude::{
string::{String, ToString},
vec::Vec,
};
#[derive(InOut)]
pub struct TableInfo {
key_order: u8,
key_column: String,
value_columns: Vec<String>,
}
#[derive(InOut... |
use std::iter;
use std::marker::PhantomData;
use std::cmp::Ordering::{ Equal, Less, Greater };
use num::traits::{ Zero, Bounded };
use util::{ self, ExtInt };
use store::Store::{ Array, Bitmap };
pub enum Store<Size: ExtInt> {
Array(Vec<Size>),
Bitmap(Box<[u64]>),
}
impl<Size: ExtInt> Store<Size> {
pub ... |
use modifier::Modifier;
use image_lib::FilterType;
use super::Image;
pub struct Resize {
pub width: u32,
pub height: u32,
}
pub struct Crop {
pub x: u32,
pub y: u32,
pub width: u32,
pub height: u32,
}
impl Modifier<Image> for Resize {
fn modify(self, image: &mut Image) {
image.val... |
use ast::*;
use name::*;
use span::{Span, Spanned, spanned};
use tokenizer::*;
use tokenizer::Token::*;
// See Chapter 18 for full grammar (p.449) (pdf p.475)
macro_rules! spanned {
($node: expr) => (spanned(span!(), $node));
}
parser! parse {
// XXX: This syntax looks ugly
Token;
Span;
(a, b) {... |
use crate::atomicmin::AtomicMin;
use crate::error::PngError;
use crate::PngResult;
use miniz_oxide::deflate::core::*;
pub(crate) fn compress_to_vec_oxipng(
input: &[u8],
level: u8,
window_bits: i32,
strategy: i32,
max_size: &AtomicMin,
deadline: &crate::Deadline,
) -> PngResult<Vec<u8>> {
/... |
use crate::{
arch::Architecture,
preload_interface::syscall_patch_hook,
remote_code_ptr::RemoteCodePtr,
remote_ptr::{RemotePtr, Void},
session::{address_space::address_space, task::record_task::RecordTask},
};
use std::{
collections::{HashMap, HashSet},
ffi::OsStr,
};
const MAX_VDSO_SIZE: u... |
#![allow(dead_code)]
///!
///! This module holds utility functions for vector manipulation.
///! This includes sequences, arrays, and polynomials.
///!
use crate::prelude::*;
use alloc::vec::Vec;
#[inline]
#[cfg_attr(feature = "use_attributes", not_hacspec)]
/// Pad (append) a slice `v` to length `l` with `T::default(... |
use files::Fd;
use fuse::FileType;
use nix::sys::xattr as _xattr;
use nix::Result;
use readlink::readlinkat;
use std::ffi::OsStr;
pub fn setxattr(fd: &Fd, kind: FileType, name: &OsStr, value: &[u8], flags: u32) -> Result<()> {
if kind == FileType::Symlink {
let path = readlinkat(fd.raw())?;
_xattr:... |
// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4)
// from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70)
// DO NOT EDIT
use ffi;
use glib;
use glib::object::Downcast;
use glib::object::IsA;
use glib::signal::SignalHandlerId;
use glib::signal::connect;
use glib::translate::*;
use gl... |
pub mod aabb;
pub mod bvh;
pub mod camera;
pub mod hittable;
pub mod material;
pub mod onb;
pub mod pdf;
pub mod ray;
pub mod renderer;
pub mod scenes;
pub mod texture;
pub mod util;
pub mod vec3;
|
extern crate clap;
extern crate zip;
use std::fs;
use std::io;
use std::path;
use std::process;
use clap::{App, Arg};
#[cfg(target_os = "linux")]
static DEV_PLATFORM: &str = "linux";
#[cfg(target_os = "macos")]
static DEV_PLATFORM: &str = "macos";
#[cfg(target_os = "windows")]
static DEV_PLATFORM: &str = "win32";
f... |
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
#[allow(dead_code)]
struct Scanner<'a> {
cin: StdinLock<'a>,
}
#[allow(dead_code)]
impl<'a> Scanner<'a> {
fn new(cin: StdinLock<'a>) -> Scanner<'a> {
Scanner { cin: cin }
}
fn read<T: FromStr>(&mut self) -> Option<T> {
let t... |
use crate::ast;
use crate::{Parse, Spanned, ToTokens};
/// A return statement `return [expr]`.
#[derive(Debug, Clone, ToTokens, Parse, Spanned)]
pub struct ExprReturn {
/// The return token.
pub return_: ast::Return,
/// An optional expression to return.
#[rune(iter)]
pub expr: Option<Box<ast::Expr... |
use crossterm::Result;
use rand::Rng;
use rc_game::{Game, GameState, Offset, RogueCrossGame, TileType};
fn xy_idx(x: usize, y: usize, cols: usize) -> usize {
(y * cols) + x
}
#[derive(Default)]
struct Ch03Game {}
impl Game for Ch03Game {}
fn create_map(gs: &GameState, player_position: &Offset) -> Vec<TileType>... |
use volatile::Volatile;
use crate::asm;
const EFLAGS_AC_BIT: u32 = 0x00040000;
const CR0_CACHE_DISABLE: u32 = 0x60000000;
pub fn memtest(start: u32, end: u32) -> u32 {
let mut flg486 = false;
asm::store_eflags((asm::load_eflags() as u32 | EFLAGS_AC_BIT) as i32);
let mut eflags = asm::load_eflags() as u32... |
//! This crate provides methods to manipulate networking resources (links, addresses, arp tables,
//! route tables) via the netlink protocol.
//!
//! It can be used on its own for simple needs, but it is possible to tweak any netlink request.
//! See this [link creation snippet](struct.LinkAddRequest.html#example) for ... |
#[doc = r"Register block"]
#[repr(C)]
pub struct CH {
#[doc = "0x00 - DMA channel x configuration register"]
pub cr: CR,
#[doc = "0x04 - DMA channel x number of data register"]
pub ndtr: NDTR,
#[doc = "0x08 - This register must not be written when the channel is enabled."]
pub par: PAR,
#[do... |
/// bindings for ARINC653P1-5 3.6.2.1 sampling
pub mod basic {
use crate::bindings::*;
use crate::Locked;
pub type SamplingPortName = ApexName;
// TODO P2 extension
/// According to ARINC 653P1-5 this may either be 32 or 64 bits.
/// Internally we will use 64-bit by default.
/// The imple... |
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
use crate::error::{Error, Result};
use serde::ser::{Impossible, Serialize, Serializer};
/// All serde_v8 "magic" values are reduced to structs with 1 or 2 u64 fields
/// assuming usize==u64, most types are simply a pointer or pointer+len (e.g: ... |
#[doc = "Reader of register SAI_ASR"]
pub type R = crate::R<u32, super::SAI_ASR>;
#[doc = "Reader of field `OVRUDR`"]
pub type OVRUDR_R = crate::R<bool, bool>;
#[doc = "Reader of field `MUTEDET`"]
pub type MUTEDET_R = crate::R<bool, bool>;
#[doc = "Reader of field `WCKCFG`"]
pub type WCKCFG_R = crate::R<bool, bool>;
#[... |
test_normalize! {
DIR="D:\\repro"
INPUT="tests\\ui\\nonzero_fail.rs"
"
error[E0080]: evaluation of constant value failed
--> D:\\repro\\tests\\ui\\nonzero_fail.rs:7:10
|
7 | #[derive(NonZeroRepr)]
| ^^^^^^^^^^^ the evaluated program panicked at 'expected non-zero discriminant expression', D:\\repr... |
//! 3x3 Matrix
use super::common::{Mat3, Mat4, Mat2d, Quat, Vec2, hypot, EPSILON};
/// Creates a new identity mat3.
///
/// [glMatrix Documentation](http://glmatrix.net/docs/module-mat3.html)
pub fn create() -> Mat3 {
let mut out: Mat3 = [0_f32; 9];
out[0] = 1.;
out[4] = 1.;
out[8] = 1.;
ou... |
type Id = usize;
use material::Material;
use shape::Shape;
use ray::Ray;
use color::Color;
use vector::Vector3;
use ray::Intersection;
use light::Light;
#[derive(Debug)]
pub struct Scene {
objects: Vec<Id>,
materials: Vec<Option<Material>>,
shapes: Vec<Option<Shape>>,
lights: Vec<Light>
}
const MAX... |
use anyhow::{Context, Result};
use futures::StreamExt;
use kafka_settings::{producer, KafkaSettings};
use polygon::ws::{Aggregate, Connection, PolygonMessage, PolygonStatus, Quote, Trade};
use rdkafka::producer::FutureRecord;
use std::time::Duration;
use tracing::{debug, error};
pub async fn run(
settings: &KafkaS... |
use std::{
ops::Deref,
sync::{Arc, Mutex},
thread::{spawn, yield_now},
};
use criterion::{black_box, criterion_group, criterion_main, Criterion};
#[cfg(feature = "arrayvec")]
use lock_many::lock_many_arrayvec;
use lock_many::lock_many_vec;
fn run_parallel_lock_many<const THREAD_NUM: usize>(n: u64, swapped... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.