text stringlengths 8 4.13M |
|---|
use crate::prelude::*;
use crate::{
Coordinate, Line, LineString, MultiLineString, MultiPolygon, Point, Polygon, Triangle,
};
use num_traits::Float;
use std::cmp::Ordering;
use std::collections::BinaryHeap;
use rstar::{RTree, RTreeNum};
/// Store triangle information
// current is the candidate point for removal
... |
//! Implements arbitrary-precision arithmetic (big numbers).
//! The following numeric types are supported:
//!
//! ```ignore
//! Int signed integers
//! ```
//!
//mod arith;
mod int;
//mod nat;
/// The largest number base accepted for string conversions.
pub const MAX_BASE: u8 = 10 + (b'z' - b'a' + 1) + (b'Z' - b'... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[link(name = "windows")]
extern "system" {}
pub type IItemEnumerator = *mut ::core::ffi::c_void;
pub type ISettingsContext = *mut ::core::ffi::c_void;
pub type ISettingsEngine = *mut ::core::ffi::c_void;
... |
use std::collections::HashMap;
fn main() {}
fn num_as_roman(num: i32) -> String {
let mut kode = HashMap::new();
kode.insert("I", 1);
kode.insert("V", 5);
kode.insert("X", 10);
kode.insert("L", 50);
kode.insert("C", 100);
kode.insert("D", 500);
kode.insert("M", 1_000);
"Hello".to_owned()
}
... |
use std::env;
use regex::Regex;
use std::{fs, io};
use std::io::Read;
use std::fs::File;
use regex::RegexSet;
use std::path::Path;
use std::path::PathBuf;
fn collect_file_from_dir(dir: &Path) -> io::Result<Vec<PathBuf>> {
let mut result: Vec<PathBuf> = vec![];
if dir.is_dir() {
for entry in fs::read_di... |
/// These utilities are intended for use by the test suite.
use std::collections::HashMap;
use game::{Game, GamePhase, GameStatus};
use id::{Id, get_id};
use player::Player;
use zone::{Zone, ZoneDetails};
/// A test method for quickly bootstrapping a valid two-player `Game`.
pub fn new_two_player_game() -> Game {
... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
pub const FACILITY_PINT_STATUS_CODE: u32 = 240u32;
pub const FACILITY_RTC_INTERFACE: u32 = 238u32;
pub const FACILITY_SIP_STATUS_CODE: u32 = 239u32;
#[repr(transparent)]
#[derive(:: core :: c... |
//! CLI handling for object store config (via CLI arguments and environment variables).
use futures::TryStreamExt;
use object_store::memory::InMemory;
use object_store::path::Path;
use object_store::throttle::ThrottledStore;
use object_store::{throttle::ThrottleConfig, DynObjectStore};
use observability_deps::tracing:... |
use aoc2018::*;
#[derive(Clone, Copy, Debug)]
enum Area {
Track,
Inter,
Slash,
BackSlash,
}
#[derive(Clone, Copy, Debug)]
enum Dir {
Right,
Left,
Up,
Down,
}
impl Dir {
fn apply(&mut self, g: Area, turn: &mut Turn) {
*self = match (*self, g) {
(_, Area::Track) ... |
use std::collections::VecDeque;
use std::sync::{Arc, Condvar, Mutex};
// Decision Decisions (as per this commit):
// - Sends contented with one another i.e senders are also synced btw themselves.
// - We don't have a bounded variant of sender, which can allow some sort of sync
// by using a fixed size buffer. There ... |
#[doc = "Reader of register RIS"]
pub type R = crate::R<u32, super::RIS>;
#[doc = "Reader of field `FPIDCRIS`"]
pub type FPIDCRIS_R = crate::R<bool, bool>;
#[doc = "Reader of field `FPDZCRIS`"]
pub type FPDZCRIS_R = crate::R<bool, bool>;
#[doc = "Reader of field `FPIOCRIS`"]
pub type FPIOCRIS_R = crate::R<bool, bool>;
... |
use std::iter::IntoIterator;
use std::iter::Iterator;
// Unlike src1.rs, this base structure is generic over any type T, where T is a Copy type.
// This constrains NewStruct objects to containing values that are primitive types like char, bool, i8, u8, etc.
#[derive(Copy,Clone)]
pub struct NewStruct<T>
where T: Cop... |
/*
* Copyright © 2019 Peter M. Stahl pemistahl@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 applica... |
use crate::smb2::responses;
/// Decodes the little endian encoded session setup response from the server.
///
/// Note: The security buffer is decoded separately.
pub fn decode_session_setup_response_body(
encoded_body: Vec<u8>,
) -> responses::session_setup::SessionSetup {
let mut session_setup_response = res... |
trait Operation {
fn touch(&mut self) -> ();
}
#[derive(Debug)]
struct BigBlob {
payload: String,
}
impl BigBlob {
fn new() -> Self {
println!("BigBlob created");
BigBlob { payload: "Me be the BigBlob!".to_string() }
}
}
impl Operation for BigBlob {
fn touch(&mut self) -> () {
... |
#[allow(unused_imports)]
use proconio::{
input, fastout,
};
fn solve(n: usize) -> usize {
let ans: usize;
if n % 1000 == 0 {
ans = 0;
} else {
ans = 1000 - (n % 1000);
}
ans
}
fn run() -> Result<(), Box<dyn std::error::Error>> {
input! {
n: usize,
}
print... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[link(name = "windows")]
extern "system" {
pub fn WMCreateBackupRestorer(pcallback: ::windows_sys::core::IUnknown, ppbackup: *mut IWMLicenseBackup) -> ::windows_sys::core::HRESULT;
pub fn WMCreate... |
use mozjpeg;
use std::path::{ Path, PathBuf };
use std::{str, fs};
use sciter::Value;
use crate::misc::{ Args, Options, make_error_message, append_dir };
pub fn compress_file(file_name: String, options: Options) -> Args {
println!("jpg::compress_file");
let path = Path::new(&file_name);
if !path.is_file() {
... |
use std::iter::Map;
use std::io::{self, BufRead, Lines, Result};
use std::cmp;
/* day 1 */
fn fuel_for(mass: u32) -> u32 {
cmp::max(mass / 3, 2) - 2
}
/* day 2 */
fn fuel_for_rec(mass: u32) -> u32 {
let fuel = fuel_for(mass);
if fuel > 0 {
fuel + fuel_for_rec(fuel)
} else {
fuel
}
... |
#![allow(dead_code)]
use std::{cmp, io};
use atoi::FromRadix10;
use ntex::util::{BufMut, BytesMut};
pub const SIZE: usize = 27;
pub fn get_query_param(query: Option<&str>) -> u16 {
let query = query.unwrap_or("");
let q = if let Some(pos) = query.find('q') {
u16::from_radix_10(query.split_at(pos + 2)... |
use std::collections::HashSet;
use crate::{prelude::*, map::{Map, MapClass}};
/// Subsequently chains two mappins together.
pub struct Chain<F: Map, S: Map> {
pub first: F,
pub second: S,
}
impl<F: Map, S: Map> Chain<F, S> {
pub fn new(first: F, second: S) -> Self {
Self { first, second }
}
}
... |
#[doc = "Reader of register CTL"]
pub type R = crate::R<u32, super::CTL>;
#[doc = "Writer for register CTL"]
pub type W = crate::W<u32, super::CTL>;
#[doc = "Register CTL `reset()`'s with value 0"]
impl crate::ResetValue for super::CTL {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
... |
use crate::geometry::vector::dot;
use crate::math::next_float_down;
use crate::math::next_float_up;
use crate::medium::Medium;
use crate::types::Float;
use crate::Normal3f;
use crate::Point3f;
use crate::Vector3f;
use num::abs;
use num::Signed;
#[derive(Clone)]
pub struct Ray {
pub origin: Point3f,
pub directi... |
use rand;
//extern crate openssl;
use std::prelude::v1::*;
use sha1::Sha1;
//#[test]
pub fn test_simple() {
let mut m = Sha1::new();
let tests = [
("The quick brown fox jumps over the lazy dog",
"2fd4e1c67a2d28fced849ee1bb76e7391b93eb12"),
("The quick brown fox jumps over the lazy c... |
// Copyright 2015 Jerome Rasky <jerome@rasky.co>
//
// 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... |
use color_frame::ColorFrame;
use rustual_boy_core::sinks::Sink;
use rustual_boy_core::vip::DISPLAY_PIXELS;
/// A utility for adjusting a ColorFrame's gamma curve.
/// Typically used with a gamma of 2.2 to prepare a linear
/// buffer for sRGB pixel output.
pub struct GammaAdjustSink<T: Sink<ColorFrame>> {
inner: T,... |
// Copyright 2021 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 ... |
use std::ops::{Add, Div, Index, Mul, Neg, Sub};
use rand::Rng;
use rand::distributions::Standard;
use rand::prelude::Distribution;
#[derive(Debug)]
pub enum Axis {
X,
Y,
Z
}
impl Distribution<Axis> for Standard {
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Axis {
match rng.gen_range(0..=2) {
... |
use crate::Error;
use std::fmt;
/// A constant value.
#[derive(Clone, Hash, PartialEq, Eq)]
pub enum Constant {
/// The unit constant (always has constant id = 0).
Unit,
/// A boolean constant.
Bool(bool),
/// A character constant.
Char(char),
/// A byte constant.
Byte(u8),
/// An i... |
use bytemuck::{Pod, Zeroable};
#[derive(Copy, Clone, Debug, Pod, Zeroable)]
#[repr(C)]
pub struct Pos {
pub x: f32,
pub y: f32,
pub z: f32,
}
impl Pos {
pub const fn new(x: f32, y: f32, z: f32) -> Self {
Self { x, y, z }
}
}
#[derive(Copy, Clone, Debug, Pod, Zeroable)]
#[repr(C)]
pub struct Uv {
pub u: f32,
... |
mod conversions;
pub use crate::conversions::celsisus::from_celsisus;
pub use crate::conversions::fahrenheit::from_farenheight;
pub use crate::conversions::kelvin::from_kelvin;
pub use crate::conversions::temp_units::units; |
use clap::ArgMatches;
use asciii::actions::setup_luigi_with_git;
use asciii::util;
use ::cli::execute;
use super::matches_to_paths;
/// Command LOG
pub fn git_log() {
let luigi = execute(setup_luigi_with_git);
let repo = luigi.repository().unwrap();
if !repo.log().success() {
error!("git log did ... |
#[doc = "Reader of register DAC_SR"]
pub type R = crate::R<u32, super::DAC_SR>;
#[doc = "Writer for register DAC_SR"]
pub type W = crate::W<u32, super::DAC_SR>;
#[doc = "Register DAC_SR `reset()`'s with value 0"]
impl crate::ResetValue for super::DAC_SR {
type Type = u32;
#[inline(always)]
fn reset_value() ... |
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
#[cfg(test)]
mod tests {
use super::*;
use std::mem;
use std::ptr;
use std::ffi::CString;
use std::ffi::CStr;
#[test]
fn constants() {
as... |
use franklin_crypto::bellman::pairing::ff::{Field, PrimeField};
use franklin_crypto::bellman::pairing::Engine;
// Substitution box is non-linear part of permutation function.
// It basically computes power of each element in the state.
// Usually value of alpha is either 5 or 3. We keep a generic
// handler other val... |
use dynasm::dynasm;
use dynasmrt::{x64::Assembler, DynasmApi};
// TODO: NOP generator <https://stackoverflow.com/a/36361832/4696352>
pub(crate) fn assemble_read4(code: &mut Assembler, reg: usize, address: usize) {
assert!(address <= (u32::max_value() as usize));
dynasm!(code; mov Rd(reg as u8), DWORD [address... |
use rust_algorithms::linked_list::List;
use rust_algorithms::linked_list::List::{Nil, Cons};
use rust_algorithms::linked_list;
/// True if the list contains a pair of different elements that add to `total`.
fn has_pair_adding_to(total : i32, xs : &List<i32>) -> bool {
fn mapper(xs : &List<i32>) -> List<i32> {
... |
use arrow_util::assert_batches_eq;
use data_types::{StatValues, Statistics};
use mutable_batch::{writer::Writer, MutableBatch, TimestampSummary};
use schema::Projection;
use std::num::NonZeroU64;
fn get_stats(batch: &MutableBatch) -> Vec<(&str, Statistics)> {
let mut stats: Vec<_> = batch
.columns()
... |
extern crate num_bigint;
extern crate num_traits;
extern crate hex;
extern crate rand;
use num_bigint::{BigUint};
use num_bigint::*;
use num_traits::*;
use num_bigint::Sign::*;
fn main() {
let mut rng = rand::thread_rng();
let p_buff = "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea6... |
//! # Chapter 7: Integrating the Parser
//!
//! So far, we've highlighted how to incrementally parse, but how do we bring this all together
//! into our application?
//!
//! Parsers we've been working with look like:
//! ```rust
//! # use winnow::error::ContextError;
//! # use winnow::error::ErrMode;
//! # use winnow::... |
pub mod tcp;
mod tests;
pub mod udp;
pub struct Range {
pub min: u16,
pub max: u16,
}
type Port = u16;
impl Default for Range {
fn default() -> Self {
Range {
min: 1024,
max: 65535,
}
}
}
/// A trait for defining behaviour on the lib's functions
pub trait Ops ... |
use color_eyre::eyre::Result;
use dotenv::dotenv;
use structopt::StructOpt;
mod day;
mod init;
mod run;
use init::Init;
use run::Run;
#[derive(StructOpt)]
#[structopt(name = "Advent Of Code")]
enum Args {
/// Download input file for given day
Init(Init),
/// Run code of the given day
Run(Run),
}
fn ... |
extern crate afs_util;
use std::fs::File;
use std::io::{BufReader, BufWriter};
use std::path::PathBuf;
use std::env;
use afs_util::AfsWriter;
struct FileGetter {
path: PathBuf,
total_files: usize,
idx: usize,
}
impl FileGetter {
fn new<P>(into_path: P) -> FileGetter
where P: Into<PathBuf>
... |
// Copyright 2021 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 ... |
extern crate logged_fu_skater;
#[cfg(feature = "default-implementations")]
use logged_fu_skater::Obfuscateable;
#[test]
fn test_default_implementation() {
for test in TEST_CASES {
let result = test.input.obfp(test.padding);
assert_eq!(&result, test.expected_result, "input: {},\npadding: {}",test... |
#![allow(dead_code)]
use crate::register_def::*;
use crate::CPUOpFn;
use crate::Memory;
use crate::VMState;
pub fn make_cpu_op_add(left_src: usize, right_src: usize, dst: usize) -> Box<CPUOpFn> {
Box::new(move |vm_state: &mut VMState| {
vm_state.cpu.regs[dst] = vm_state.cpu.regs[left_src] + vm_state.cpu.r... |
use crate::Result;
use std::{
io::Read,
process::{Child, Output},
sync::mpsc,
};
pub fn stdout_and_stderr(out: Output) -> String {
let out = if !out.stdout.is_empty() {
out.stdout
} else {
out.stderr
};
String::from_utf8(out).unwrap_or_default()
}
pub trait ProcessUtils {
... |
extern crate bootstrap_rs as bootstrap;
extern crate polygon;
use bootstrap::window::*;
use polygon::*;
fn main() {
// Open a window and create the renderer instance.
let mut window = Window::new("Hello, Triangle!").unwrap();
let mut renderer = RendererBuilder::new(&window).build();
'outer: loop {
... |
use crate::lock::{
MapImmutable, PyImmutableMappedMutexGuard, PyMappedMutexGuard, PyMappedRwLockReadGuard,
PyMappedRwLockWriteGuard, PyMutexGuard, PyRwLockReadGuard, PyRwLockWriteGuard,
};
use std::{
fmt,
ops::{Deref, DerefMut},
};
macro_rules! impl_from {
($lt:lifetime, $gen:ident, $t:ty, $($var:i... |
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use glib;
use glib::object::Cast;
use glib::object::IsA;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
use glib::translate::*;
use glib::GString;
use glib::Static... |
use std::{
ffi::OsStr,
time::{Duration, Instant},
};
use async_fuse::FileAttr;
use menmos_client::{Meta, Type};
use crate::{constants, MenmosFS};
use super::{build_attributes, Error, Result};
pub struct LookupReply {
pub ttl: Duration,
pub attrs: FileAttr,
pub generation: u64,
}
impl MenmosFS {... |
//! Policy framework for [backends](crate::backend::CacheBackend).
use std::{
cell::RefCell,
collections::{HashMap, VecDeque},
fmt::Debug,
hash::Hash,
marker::PhantomData,
ops::Deref,
sync::{Arc, Weak},
};
use iox_time::{Time, TimeProvider};
use parking_lot::{lock_api::ArcMutexGuard, Mutex... |
// Copyright 2020 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 2019 The Gotts Developers
//
// 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... |
// Copyright 2016 Google 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-2.0
//
// Unless required by applicable law or agreed to in... |
use crate::ray::{Hit, Hitable, Ray};
impl Hitable for Vec<Box<dyn Hitable>> {
fn hit(&self, ray: &Ray, t_min: f64, t_max: f64, hit: &mut Hit) -> bool {
let mut hit_anything = false;
let mut closest_so_far = t_max;
for hitable in self.iter() {
if hitable.hit(ray, t_min, closest_... |
use morgan_interface::account::Account;
use morgan_interface::genesis_block::GenesisBlock;
use morgan_interface::pubkey::Pubkey;
use morgan_interface::signature::{Keypair, KeypairUtil};
use morgan_interface::system_program;
use morgan_stake_api::stake_state;
use morgan_vote_api::vote_state;
// The default stake placed... |
fn main() {
let points = 10i32;
let mut saved_points: u32 = 0;
saved_points = points as u32;
} |
//! A macro to generate the corresponding Generations rule of a rule.
#![macro_use]
/// Implements `Rule` trait for a rule and the corresponding Generations rule.
macro_rules! impl_rule {
{
$(#[$doc_desc:meta])*
pub struct NbhdDesc($desc_type:ty);
$(#[$doc:meta])*
pub struct $rule:... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[link(name = "windows")]
extern "system" {}
pub type UsbBulkInEndpointDescriptor = *mut ::core::ffi::c_void;
pub type UsbBulkInPipe = *mut ::core::ffi::c_void;
pub type UsbBulkOutEndpointDescriptor = *mut... |
use anyhow::Result;
use diesel::PgConnection;
use super::entity::Paste;
use super::orm;
use crate::utils::is_url;
pub fn create_paste(paste: &mut Paste, conn: &PgConnection) -> Result<usize> {
paste.is_url = Some(is_url(paste.body.clone()));
orm::create_paste(paste, conn)
}
pub fn get_paste(id: String, conn... |
use crate::{DocBase, VarType};
pub fn gen_doc() -> Vec<DocBase> {
let fn_doc = DocBase {
var_type: VarType::Function,
name: "floor",
signatures: vec![],
description: "",
example: "",
returns: "The largest integer less than or equal to the given number.",
argu... |
use crate::tokenizer::{OperationType, Token};
pub fn process_token_list(tokens: &[Token]) -> Option<i64> {
let size = tokens.len();
if size == 0 {
return Some(0);
}
let mut result = 0;
let mut token_index = 0;
let mut value_index = 0;
for index in 0..size {
let token = &t... |
use P63::*;
pub fn main() {
let cbt = complete_binary_tree(6, 'x');
println!("{}", cbt);
}
|
struct ProconReader<R: std::io::Read> {
reader: R,
}
impl<R: std::io::Read> ProconReader<R> {
fn new(reader: R) -> Self {
Self { reader }
}
fn get<T: std::str::FromStr>(&mut self) -> T {
use std::io::Read;
let buf = self
.reader
.by_ref()
.byt... |
pub mod large;
pub mod small;
use liblumen_alloc::erts::exception::InternalResult;
use liblumen_alloc::erts::term::prelude::*;
use liblumen_alloc::erts::Process;
use super::decode_vec_term;
fn decode<'a>(
process: &Process,
safe: bool,
bytes: &'a [u8],
len: usize,
) -> InternalResult<(Term, &'a [u8])... |
use super::core_namespace::*;
use super::super::symbol::*;
use futures::*;
use gluon::{Thread, Compiler};
use gluon::vm::{ExternModule, Result, Variants};
use gluon::vm::api::{VmType, FunctionRef, ValueRef, ActiveThread, Getable, Pushable, UserdataValue};
use gluon::vm::api::generic::{A};
use gluon::import;
use desync... |
use crate::types::Float;
use crate::Normal3f;
use crate::Vector3f;
use std::rc::Rc;
#[derive(Clone)]
pub struct BSDF {
pub eta: Float,
pub ns: Normal3f,
pub ng: Normal3f,
pub ss: Vector3f,
pub ts: Vector3f,
pub bxdf_count: i32,
pub bxdfs: Vec<Rc<BxDF>>,
}
pub enum BxDFType {
Reflection... |
use uuid::Uuid;
pub fn generate_uuid() -> String {
let uuid = Uuid::new_v4().to_hyphenated();
format!("{}", uuid)
}
|
// 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 {
crate::{story_manager::StoryManager, utils},
failure::{Error, ResultExt},
fidl_fuchsia_app_discover::{
SessionDiscoverContextRequ... |
mod area;
mod building;
mod bus_stop;
mod edits;
mod intersection;
mod lane;
mod make;
mod map;
mod neighborhood;
pub mod osm;
mod pathfind;
pub mod raw_data;
mod road;
mod stop_signs;
mod traffic_signals;
mod traversable;
mod turn;
pub use crate::area::{Area, AreaID, AreaType};
pub use crate::building::{Building, Bui... |
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use glib::object::Cast;
use glib::object::IsA;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
use glib::translate::*;
use glib::GString;
use glib_sys;
use libc;
us... |
//! The relocation package provide two structures: RelocSink, TrapSink.
//! This structures are used by Cranelift when compiling functions to mark
//! any other calls that this function is doing, so we can "patch" the
//! function addrs in runtime with the functions we need.
use cranelift_codegen::binemit;
pub use cran... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[link(name = "windows")]
extern "system" {}
pub type SpatialSurfaceInfo = *mut ::core::ffi::c_void;
pub type SpatialSurfaceMesh = *mut ::core::ffi::c_void;
pub type SpatialSurfaceMeshBuffer = *mut ::core:... |
#[cfg(feature = "v2")]
use crate::v2::models::{DataType, ParameterIn};
use thiserror::Error;
/// Errors related to spec validation.
#[derive(Debug, Error)]
pub enum ValidationError {
/// Failed to resolve the schema because an invalid URI was provided for
/// `$ref` field.
///
/// Currently, we only su... |
use crate::{board_logic::*, console_display::*, *};
#[test]
fn it_translates() {
assert_eq!(to_coords("a5".to_string()).unwrap(), (0, 4));
assert_eq!(to_notation((0, 4)).unwrap(), ("a5"));
}
#[test]
#[should_panic(expected = "Tried to add piece at non-empty space at (0, 0)")]
fn occupied_spot() {
let mut bo... |
// Copyright (c) 2020 DarkWeb Design
//
// 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... |
use game::*;
impl Suppressable{
pub fn default(mover_id: MoverID)->Suppressable{
Suppressable{
mover_id: mover_id,
voluntary_xspeed: 0.0,
voluntary_yspeed: 0.0,
involuntary_forces: Vec::new(),
stunned_for: 0,
disabled_for: 0
}
}
pub fn remove(game: &mut Game1, id: SuppressableID){
game.suppr... |
use crate::raycasting::ray::HitPoint;
use crate::raycasting::ray::Ray;
use crate::types::{Vector3f};
use crate::geom::rand_geom::random_in_unit_sphere;
use dyn_clone::{clone_trait_object, DynClone};
pub trait Material : Send + Sync + DynClone {
fn scatter (&self,
ray: &Ray, rec: &HitPoint) -> Option<(Vect... |
use sdl2::rect::{Rect};
use sdl2::pixels::Color;
use sdl2::render::{WindowCanvas, Texture};
use crate::Constants;
#[derive(Copy, Clone)]
pub struct Tile {
pub rect: Rect,
pub color: Color,
pub selected: bool
}
impl Tile {
pub fn new( x: i32, y: i32, passed:Color ) -> Tile {
Tile {
... |
use std::vec::Vec;
use std::string::String;
use std::collections::{HashSet, HashMap};
use std::{thread, time};
use std::cell::RefCell;
use std::error::Error;
use std::fs::File;
use std::io::BufReader;
use std::path::Path;
use thirtyfour_sync::prelude::*;
use serde::Deserialize;
use serde_json::Value;
use lettre::transp... |
use self_cell::self_cell;
type Dep1<'a> = (&'a str, &'static str);
self_cell! {
pub struct Struct1 {
owner: String,
#[covariant]
dependent: Dep1,
}
}
type Dep2<'a> = (&'static str, &'a str);
self_cell! {
pub struct Struct2 {
owner: String,
#[covariant]
dep... |
#![feature(proc_macro_span)]
extern crate peg;
extern crate proc_macro;
use std::fs;
use std::iter;
use proc_macro::{ TokenStream, TokenTree, Span, Delimiter };
#[proc_macro]
pub fn peg(input: TokenStream) -> TokenStream {
let (name, source, span) = parse_peg_args(input);
let line = span.start().line;
... |
use std::collections::HashMap;
use crate::mechanics::damage::DamageMultiplier;
use crate::types::MonsterType;
use crate::types::MonsterType::*;
struct EffectivenessMap {
map: HashMap<MonsterType, DamageMultiplier>,
}
impl EffectivenessMap {
fn new() -> EffectivenessMap {
EffectivenessMap {
... |
use crate::header::Header;
use crate::header_flag::HeaderFlag;
use crate::message_render::MessageRender;
use crate::name::Name;
use crate::question::Question;
use crate::rr_class::RRClass;
use crate::rr_type::RRType;
use crate::util::InputBuffer;
use anyhow::{bail, Result};
use std::fmt;
#[derive(Debug, Clone, Eq, Par... |
pub mod boids;
|
fn main(){
proconio::input!{n:f64};
println!("{}",2.*n*std::f64::consts::PI)
} |
use lazy_static::lazy_static;
use std::path;
use std::sync::{atomic, mpsc, Mutex};
use std::thread;
use std::time;
use crate::commands::{LllCommand, LllRunnable};
use crate::context::LllContext;
use crate::error::LllError;
use crate::fs::{fs_extra_extra, LllDirList};
use crate::window::LllView;
lazy_static! {
sta... |
use axum::{
handler::{get, post},
AddExtensionLayer, Router,
};
use fork_backend::auth::{self, session::UserSession};
use fork_backend::init::init_appliations;
use std::net::SocketAddr;
use tracing::info;
#[tokio::main]
async fn main() {
let app_connections = init_appliations();
info!("build app router... |
//! Configuration
use serde::Deserialize;
use failure::Fail;
use std::{
fs::read_to_string,
io,
path::Path,
};
use toml;
#[derive(Clone, Deserialize)]
// Global configuration structure
pub struct Cfg {
/// Web server configuration
pub server: ServerCfg,
// /// Log mechanism configuration
//... |
use super::basic;
use super::tile::Terrain;
use grid::{self, Grid, Pos};
use rand::Rng;
pub(super) fn add_exit<R: Rng>(level: &mut Grid<Terrain>, rng: &mut R) -> Grid<Terrain> {
let mut positions: Vec<Pos> = grid::inner_positions().collect();
rng.shuffle(&mut positions);
loop {
let next_level = bas... |
#![cfg(target_arch = "x86_64")]
use std::arch::x86_64::*;
use crate::detail::sse::{hi_dp_bc, rcp_nr1, rsqrt_nr1}; //hi_dp, hi_dp_ss
// Partition memory layouts
// LSB --> MSB
// p0: (e0, e1, e2, e3)
// p1: (1, e23, e31, e12)
// p2: (e0123, e01, e02, e03)
// p3: (e123, e032, e013, e021)
// a := p1
// b := p2
// a... |
// Copyright 2018 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 {
failure::Error,
fidl_fuchsia_test_echos::{EchoExposedByParentMarker, EchoHiddenByParentMarker},
fuchsia_async as fasync,
fuchsia_comp... |
use super::lob_writer_util::{get_utf8_tail_len, LobWriteMode};
use crate::{
conn::AmConnCore,
internal_returnvalue::InternalReturnValue,
protocol::parts::{ParameterDescriptors, ResultSetMetadata, TypeId, WriteLobRequest},
protocol::{util, Part, PartKind, Reply, ReplyType, Request, RequestType},
{Hdb... |
/**
* Copyright © 2019
* Sami Shalayel <sami.shalayel@tutamail.com>,
* Carl Schwan <carl@carlschwan.eu>,
* Daniel Freiermuth <d_freiermu14@cs.uni-kl.de>
*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published... |
use ggez::{
conf, event,
graphics::{self, Font, Rect, Text},
nalgebra::Point2,
Context, ContextBuilder, GameResult,
};
use ggwp_zgui as ui;
#[derive(Clone, Copy, Debug)]
enum Message {
Command1,
Command2,
}
fn make_gui(context: &mut Context, font: Font) -> ui::Result<ui::Gui<Message>> {
le... |
// Copyright 2021 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 ... |
#![allow(dead_code)]
use crate::{
components::*,
ecs::{systems::ParallelRunnable, *},
math::Matrix4,
};
pub fn build() -> impl ParallelRunnable {
SystemBuilder::<()>::new("LocalToWorldUpdateSystem")
// Translation
.with_query(<(Write<LocalToWorld>, Read<Translation>)>::query().filter(
... |
#[doc = "Reader of register AHB2SECSR"]
pub type R = crate::R<u32, super::AHB2SECSR>;
#[doc = "Reader of field `SDMMC1SECF`"]
pub type SDMMC1SECF_R = crate::R<bool, bool>;
#[doc = "Reader of field `OTFDEC1SECF`"]
pub type OTFDEC1SECF_R = crate::R<bool, bool>;
#[doc = "Reader of field `SRAM2SECF`"]
pub type SRAM2SECF_R ... |
#[doc = "Reader of register AWD2CR"]
pub type R = crate::R<u32, super::AWD2CR>;
#[doc = "Writer for register AWD2CR"]
pub type W = crate::W<u32, super::AWD2CR>;
#[doc = "Register AWD2CR `reset()`'s with value 0"]
impl crate::ResetValue for super::AWD2CR {
type Type = u32;
#[inline(always)]
fn reset_value() ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.