text
stringlengths
8
4.13M
//! exploration of the search space. mod candidate; mod logger; mod monitor; mod parallel_list; mod store; pub mod choice; pub mod config; pub mod eventlog; pub mod local_selection; pub mod mcts; pub use self::candidate::Candidate; pub use self::config::{BanditConfig, Config, SearchAlgorithm}; pub use self::logger::L...
pub mod stack; pub mod store; pub mod abstract_machine;
use crate::{MessageType, MatchScaleFn}; fn match_scale_accelerometer_data(_: usize) -> Option<f32> { None } fn match_scale_activity(k: usize) -> Option<f32> { match k { 0 => Some(1000.0f32), _ => None, } } fn match_scale_ant_channel_id(_: usize) -> Option<f32> { None } fn match_scale_an...
use board::grid::GoCell; use board::stones::grouprc::GoGroupRc; use board::stones::stone::Stone; pub trait GroupManipulation { fn place_stone(&mut self, cell: GoCell, stone: Stone) -> GoGroupRc; fn fusion_with(&mut self, cell: GoCell) -> (GoGroupRc, usize); fn split_with(&mut self, cell: GoCell) -> (GoGrou...
/// In-memory [`RawStream`][crate::RawStream] #[derive(Clone, Default, Debug, PartialEq, Eq)] pub struct Buffer(Vec<u8>); impl Buffer { #[inline] pub fn new() -> Self { Default::default() } #[inline] pub fn with_capacity(capacity: usize) -> Self { Self(Vec::with_capacity(capacity))...
#[doc = "Reader of register WAITSTAT"] pub type R = crate::R<u32, super::WAITSTAT>; #[doc = "Reader of field `WAITREQ`"] pub type WAITREQ_R = crate::R<u32, u32>; impl R { #[doc = "Bits 0:31 - Channel \\[n\\] Wait Status"] #[inline(always)] pub fn waitreq(&self) -> WAITREQ_R { WAITREQ_R::new((self.bi...
use crate::*; use std::collections::HashMap; #[derive(Clone, Debug)] pub struct Songs { pub songs: HashMap<HashSha256, Song>, pub converter: Converter, } impl Songs { pub fn song(&self, chart: &Chart) -> Song { let sha256 = self.get_sha256(chart.md5()); match sha256 { Some(sha2...
#![allow(deprecated)] extern crate libc; extern crate futex; use futex::raw::RwLock; use std::thread; use std::sync::Arc; fn main() { println!("lul"); let futex = Arc::new(RwLock::new()); let futex2 = futex.clone(); futex.acquire_read(); futex.acquire_read(); futex.acquire_read(); let thre...
// 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::ie::SupportedRate, failure::{format_err, Error}, std::collections::HashSet, }; pub struct ApRates(pub Vec<SupportedRate>); pub st...
mod event_handler; mod event_handlers; mod raw_event_handler; mod raw_event_handlers; pub use event_handler::BotEventHandler; pub use raw_event_handler::BotRawEventHandler;
extern crate sigar_rs; use sigar_rs::net; fn main() { let conns = net::connection_list(net::FLAG_NETCONN_CLIENT | net::FLAG_NETCONN_TCP).unwrap(); let size = if conns.len() > 10 { 10 } else { conns.len() }; let mut i = 0usize; while i < size { println!("#{:?} {:?}", i + 1, conns[i]); ...
// 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 {failure::Error, fidl_fuchsia_settings::*}; pub async fn command( proxy: DoNotDisturbProxy, user_dnd: Option<bool>, night_mode_dnd: Option...
use super::{ channel::{Capacity, Packet}, execution_controller::ExecutionController, heap::{Data, Function, Heap, Text}, lir::Instruction, }; use crate::{ channel::ChannelId, heap::{ DisplayWithSymbolTable, HirId, InlineObject, List, Pointer, ReceivePort, SendPort, Struct, Symbol...
#[derive(Debug, Fail)] pub enum TrieBuildFailure { #[fail(display = "TrieBuildFailure::Unimplemented: {}", _0)] Unimplemented(&'static str), #[fail(display = "TrieBuildFailure::UnreachableRule")] UnreachableRule, }
fn main() { let s1 = String::from("hello"); let s2 = s1; // s1 moved into s2 println!("s1: {}", s1) // compile error because s1 is invalid }
pub mod subprocess; pub mod tokio; use crate::cache::{push_cache_digest, Digest}; use crate::datastore::{generate_cache_file_path, CACHE_INFO_IN_MEMORY}; use icon::Icon; use printer::println_json; use rayon::prelude::*; use serde::{Deserialize, Serialize}; use std::path::{Path, PathBuf}; use std::process::Command; use...
use ckb_testtool::context::Context; use ckb_tool::ckb_types::{bytes::Bytes, core::TransactionBuilder, packed::*, prelude::*}; use std::fs::File; use std::io::Read; const MAX_CYCLES: u64 = 1000_0000; #[test] fn it_works() { // deploy contract let mut context = Context::default(); let contract_bin = { ...
#[macro_use] extern crate slog; pub mod get_command; pub mod config;
use super::*; pub use self::traits::*; mod traits; /// Like a [`Vec`], but inlined / "stored in the stack" /// /// It is backed by a partially uninitialised [`array`], that keeps track of /// its initialised / uninitialised slots by using a `len: usize` field. /// /// **Its capacity is the length of the backing [`arr...
use crate::{Coordinate, CoordinateType, Point}; /// A line segment made up of exactly two [`Point`s](struct.Point.html). #[derive(Eq, PartialEq, Clone, Copy, Debug, Hash)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct Line<T> where T: CoordinateType, { pub start: Coordinate<T>, ...
// Copyright 2017 rust-ipfs-api Developers // // Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or // http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except accord...
use actix::{Actor, StreamHandler}; use actix_web::dev::Payload; use actix_web::error::Error; use actix_web::ws::{handshake, Message, ProtocolError, WebsocketContext, WsStream}; use actix_web::{HttpMessage, HttpRequest, HttpResponse}; pub fn start<F, A, S>(req: &HttpRequest<S>, actor: A, map: F) -> Result<HttpResponse,...
// Copyright 2019. The Tari Project // // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the // following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following // disclai...
//! Actix Connector - tcp connector service //! //! ## Package feature //! //! * `tls` - enables ssl support via `native-tls` crate //! * `ssl` - enables ssl support via `openssl` crate //! * `rust-tls` - enables ssl support via `rustls` crate mod connector; mod resolver; pub mod ssl; pub use self::connector::{ C...
#[macro_use] extern crate serde_derive; extern crate rmp_serde as rmps; use std::io::Cursor; use serde::Deserialize; use crate::rmps::decode::Error; use crate::rmps::Deserializer; #[test] fn pass_newtype() { let buf = [0x2a]; let cur = Cursor::new(&buf[..]); #[derive(Debug, PartialEq, Deserialize)] ...
use crate::test_struct::*; pub fn connect(){ println!("this is connect"); test_struct(); }
pub use VkDebugReportFlagsEXT::*; #[repr(u32)] #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum VkDebugReportFlagsEXT { VK_DEBUG_REPORT_INFORMATION_BIT_EXT = 0x00000001, VK_DEBUG_REPORT_WARNING_BIT_EXT = 0x00000002, VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT = 0x00000004, VK_DEBUG_REPORT_ERROR_BI...
use anyhow::Context; use stark_hash::{stark_hash, Felt}; fn main() -> anyhow::Result<()> { let mut args = std::env::args(); let myself = args .next() .unwrap_or_else(|| String::from("compute_contract_state_hash")); let args = args .map(|x| Felt::from_hex_str(&x).map(Some)) ...
use iced::{Sandbox, Element, Button, Column, Text, Settings, Container, Length, Align, HorizontalAlignment, Color, Background, button}; use iced::settings::Window; pub fn main() { Counter::run(Settings { window: Window { size: (300, 300), // (x, y) resizable: false, } })...
use actix_web::{http::StatusCode, FromRequest, HttpResponse, Json, Path}; use bigneon_api::controllers::ticket_types; use bigneon_api::controllers::ticket_types::*; use bigneon_api::models::{EventTicketPathParameters, PathParameters}; use bigneon_db::models::*; use chrono::prelude::*; use functional::base; use serde_js...
//use std::env; fn add(matrix1: Vec<Vec<i32>>, matrix2: Vec<Vec<i32>>) -> Vec<Vec<i32>>{ let m1r = matrix1.capacity(); let m1c = matrix1[0].capacity(); let m2r = matrix2.capacity(); let m2c = matrix2[0].capacity(); return matrix1; } fn main() { //let args: Vec<String> = env::args().collect(); ...
struct User { username: String, email: String, sign_in_count: u64, active: bool, } #[derive(Debug)] struct Rectangle { width: u32, height: u32, } impl Rectangle { fn area(&self) -> u32 { self.width * self.height } fn can_hold(&self, other: &Rectangle) -> bool { sel...
use cderive::Derive; use cderive::clang::*; use std::fmt::Write; pub struct CycleCollect; macro_rules! try_opt { ($e:expr) => { try_opt!($e, return None) }; ($e:expr, $other:expr) => { match $e { Some(x) => x, None => $other, } }; } // These flags cont...
use crate::record::cell::Cell; use crate::SLKScanner; use crate::slk_type::Record; #[derive(Default, Debug)] pub struct Document { rows: u32, columns: u32, contents: Vec<Cell>, } impl Document { pub fn load(&mut self, scanner: SLKScanner){ for record in scanner{ match record { ...
use crate::prelude::*; use std::os::raw::c_void; use std::ptr; #[repr(C)] #[derive(Debug)] pub struct VkGeometryNV { pub sType: VkStructureType, pub pNext: *const c_void, pub geometryType: VkGeometryTypeNV, pub geometry: VkGeometryDataNV, pub flags: VkGeometryFlagBitsNV, } impl VkGeometryNV { ...
#[cfg(all(not(target_arch = "wasm32"), test))] mod test; use liblumen_alloc::erts::term::prelude::*; #[native_implemented::function(erlang:is_tuple/1)] pub fn result(term: Term) -> Term { match term.decode() { Ok(TypedTerm::Tuple(_)) => true.into(), _ => false.into(), } }
use core::alloc::Layout; use core::cmp; use core::mem; use core::ops::DerefMut; use core::ptr::NonNull; use liblumen_core::sys::sysconf::MIN_ALIGN; use liblumen_core::util::pointer::{distance_absolute, in_area}; use crate::erts::exception::AllocResult; use crate::erts::term::prelude::Term; /// The core trait for all...
use std::{thread::sleep, time::Duration}; fn main() { // Start the server and sleep for a bit. println!("[rs consumer test] Starting the server."); webviz_server_rs::start_server(); sleep(Duration::from_millis(1000)); // Check the server status and sleep again. let is_server_running = webviz_server_rs::is...
pub mod topic; use self::topic::Topic; use self::topic::elementary::Elementary; use self::topic::lists_strings::ListStrings; use std::collections::HashMap; pub fn parse_input(s: &str) -> Result<(&str, u8), String> { let mut iter = s.split(","); match (iter.next(), iter.next()) { (Some(topic), Some(n))...
#[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::CHMAP0 { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &...
use std::env; use std::fs; use std::path::Path; fn main() { println!("cargo:rerun-if-changed=build.rs"); let perf_libs_dir = { let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); let mut path = Path::new(&manifest_dir); path = path.parent().unwrap(); path.join(Path::new...
use front::stdlib::object::PROTOTYPE; use front::stdlib::value::{Value, ResultValue, to_value}; use front::stdlib::function::Function; /// Create a new error pub fn make_error(args:Vec<Value>, _:Value, _:Value, this:Value) -> ResultValue { if args.len() >= 1 { this.set_field("message", args[0]); } ...
/* Copyright 2020 Timo Saarinen 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 writing, software d...
fn main() { for (index, val) in (1..11).enumerate() { println!("index= {}, value= {}", index, val); } }
#[cfg(feature = "rayon")] extern crate rayon; #[cfg(feature = "rayon")] use rayon::prelude::*; #[cfg(feature = "c_api")] pub mod c_api; const ROTATE: u32 = 'z' as u32 - 'a' as u32 + 1; /// Encrypt the input using rot26. #[inline(always)] pub fn encrypt(input: &str) -> String { encrypt_any(input, 26) } /// Decr...
use calculations::util::round_float; pub fn change_by_percentage(n: f64, percent: f64) -> String { /* ChangeByPercentage: Increase/Decrease a number by a percentage. (n / 100) * p + n First work out 1% of 250, 250 ÷ 100 = 2.5 then multiply the answer by 23, because there was a 23% increase. 2.5 × 23 = 57....
#![feature(plugin, custom_derive, const_fn)] #![plugin(rocket_codegen)] extern crate rocket; #[macro_use] extern crate serde_json; #[macro_use] extern crate diesel; #[macro_use] extern crate diesel_codegen; #[macro_use] extern crate serde_derive; extern crate rocket_contrib; extern crate r2d2; extern crate r2d2_diesel...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 pub use libra_crypto::hash::HashValue; pub use crypto_macro::CryptoHash; pub use libra_crypto::hash::CryptoHash as LibraCryptoHash; /// A type that implements `CryptoHash` can be hashed by a cryptographic hash function and produc...
extern crate chrono; extern crate colored; extern crate dotenv; extern crate irc; extern crate parking_lot; extern crate regex; extern crate serde; extern crate termion; extern crate textwrap; extern crate toml; extern crate tui; #[macro_use] extern crate serde_derive; #[macro_use] extern crate lazy_static; pub mod ...
//! Contains various cameras and their projection matrices. mod arcball; pub use self::arcball::ArcBall; use na::Matrix4; use std::f32; use window::Event; /// Represents a camera in 3D space. pub trait Camera { fn get_position(&self) -> (f32, f32, f32); fn handle_events(&mut self, event: &Event); fn get_...
//! ```elixir //! case Lumen.Web.Window.window() do //! {:ok, window} -> ... //! :error -> ... //! end //! ``` use liblumen_alloc::erts::process::Process; use liblumen_alloc::erts::term::prelude::Term; use crate::option_to_ok_tuple_or_error; #[native_implemented::function(Elixir.Lumen.Web.Window:window/0)] pub...
use aoc_runner_derive::{aoc, aoc_generator}; use lazy_static::lazy_static; use regex::Regex; use std::collections::HashMap; #[aoc_generator(day4)] fn input_parse(input: &str) -> Vec<HashMap<String, String>> { let mut passports = Vec::new(); let mut passport: HashMap<String, String> = HashMap::new(); for li...
pub mod buffer_writer; pub mod logger;
//mod chat; extern crate serde_mcproto; pub mod v1_7_10; // pub mod v1_8; pub use serde_mcproto::de::deserialize; pub use serde_mcproto::ser::serialize; pub use serde_mcproto::types; pub use serde_mcproto::{de::MCProtoDeserializer, ser::MCProtoSerializer}; pub use serde_mcproto::read_varint; pub use serde_mcproto::w...
use juniper::{GraphQLInputObject, GraphQLObject}; #[derive(GraphQLObject)] struct ObjectA { test: String, } #[derive(GraphQLInputObject)] struct Object { field: ObjectA, } fn main() {}
// Demonstration that you can't pass &T into functions that // expect a trait implemented by T. // // If you implement a trait for type T, but all you have // is a reference &T, you can still call trait methods, but // you can't pass the &T to methods that expect the trait. // That is, not without a hack like my TraitD...
// Notes: // Varchar will not have a limit, in rust this means it will be hardcoded when compiled. // This file contains meta command handling, CLI input and the high level while loop for the db. use std::io::{self, Read, Write}; mod statements; mod table; mod data_structures; use statements::ExecuteResul...
// 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 ...
// 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 ...
//! Helper traits and types. use super::types::Tag; use super::traits::ToNbt; /// Index trait for index operations where a result may not be available. pub trait IndexOpt<Idx> { type Output; fn index_opt<'a>(&'a self, i: Idx) -> Option<&'a Self::Output>; } /// Index trait for mutable index operations where ...
use std::collections::HashMap; use std::path::PathBuf; use xdg::BaseDirectories; #[derive(Debug, Clone)] pub struct AutostartItem { system_file: Option<PathBuf>, system: bool, local_file: Option<PathBuf>, local_state: FileState, } #[derive(Debug, Clone, PartialEq, Eq)] pub enum FileState { StateTransie...
pub const VENDOR: u16 = 0xDEAD; pub const PRODUCT: u16 = 0xDEAD; pub const VERSION: u16 = 0xDEAD;
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtWidgets/qcolordialog.h // dst-file: /src/widgets/qcolordialog.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end // main block ...
use super::*; #[derive(Clone)] pub enum MapKey<K> { Value(K), /// This is a horrible hack. Query(NonNull<MapQuery<'static, K>>), } impl<K> MapKey<K> { #[inline] pub fn into_inner(self) -> K { match self { MapKey::Value(v) => v, _ => unreachable!("This is a BUG!!!!!!...
use std::path::{Path, PathBuf}; use std::fs::File; use std::io::Read; use anyhow::Result; use digest::{Digest, DynDigest}; use crate::cmd_line::Algorithm; use crate::error::AppError; fn get_hasher(algorithm: Algorithm) -> Box<dyn DynDigest> { match algorithm { Algorithm::MD5 => Box::new(md5::Md5::new()), ...
use crate::erlang::self_0::result; use crate::test::with_process; #[test] fn returns_process_pid() { with_process(|process| { assert_eq!(result(&process), process.pid_term()); }); }
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Global configuration register"] pub gcr: GCR, #[doc = "0x04 - Cluster CH%s, containing ?CR1, ?CR2, ?FRCR, ?SLOTR, ?IM, ?SR, ?CLRFR, ?DR"] pub cha: CH, #[doc = "0x24 - Cluster CH%s, containing ?CR1, ?CR2, ?FRCR, ?SLOTR, ...
// 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 ...
// Based on ws-addr.xsd // targetNamespace="http://www.w3.org/2005/08/addressing" // xmlns:xs="http://www.w3.org/2001/XMLSchema" // xmlns:tns="http://www.w3.org/2005/08/addressing" use std::io::{Read, Write}; use yaserde::{YaDeserialize, YaSerialize};
use super::parser::*; use anyhow::{anyhow, Result}; use maplit::hashmap; use std::collections::HashMap; #[derive(Debug)] pub struct CCommand { pub dest: Dest, pub comp: Comp, pub jump: Jump, pub addr: usize, source: Source, } // C-Command dest operand #[derive(PartialEq, Clone, Copy, Debug, en...
use abi_stable::{std_types::RCow, DynTrait}; use example_0_interface::CowStrIter; use super::*; /// This tests that a type coming from a dynamic library /// cannot be converted back to its std-library equivalent /// while reusing the heap allocation. /// /// The reason why they can't reuse the heap allocation is bec...
extern crate wiring1; use wiring1::*; const PIN_LED: i32 = 0; const PIN_INPUT: i32 = 3; fn main() { println!("Hello, world!"); wiringPiSetup(); pinMode(PIN_LED, cffi::OUTPUT); pinMode(PIN_INPUT, cffi::INPUT); loop { digitalWrite(PIN_LED, cffi::HIGH); println!("input = {}", digit...
use std::{ any::TypeId, fmt::{Debug, Formatter, Result}, }; use super::event_type::EventType; /// An Event is a struct of data that can be sent and recreated on the connected /// remote host pub trait Event<T: EventType>: EventClone<T> { /// Whether the Event is guaranteed for eventual delivery to the rem...
fn main() { logging::init_logging().expect("Unable to initialize logging"); logging::test_logging(); }
pub mod bakerbird; pub mod naive;
use itertools::Itertools as _; use std::{ collections::VecDeque, io::{self, Read}, }; const START_MSG_DISTINCT_CHARS_COUNT: usize = 14; fn main() -> io::Result<()> { let mut offset = START_MSG_DISTINCT_CHARS_COUNT; let mut stream: VecDeque<u8> = VecDeque::default(); let mut buf = [0; 4096]; ...
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::account_address::AuthenticationKey; use libra_crypto::{ ed25519::{Ed25519PublicKey, Ed25519Signature}, multi_ed25519::{MultiEd25519PublicKey, MultiEd25519Signature}, traits::Signature, HashValue, }; use anyh...
use std::fmt::Display; use num_traits::AsPrimitive; use crate::{InputType, InputValueError}; pub fn maximum<T, N>(value: &T, n: N) -> Result<(), InputValueError<T>> where T: AsPrimitive<N> + InputType, N: PartialOrd + Display + Copy + 'static, { if value.as_() <= n { Ok(()) } else { E...
use diesel::{pg, prelude::*, r2d2::ConnectionManager}; use failure::{Fallible, ResultExt}; use r2d2::{Pool, PooledConnection}; pub mod dao; pub mod model; pub mod pagination; mod schema; pub use self::dao::ApiDao; pub use self::model::*; pub use self::pagination::*; pub type DB = pg::Pg; pub type DBConn = pg::PgConn...
pub use crate::song::{ artist::Artist, hash::{HashMd5, HashSha256}, hash_converter::Converter, include_features::IncludeFeatures, level::{Level, Levels}, song::Song, song_with_snap::SongWithSnap, songs::{SongFormat, Songs, SongsBuilder}, title::Title, };
// 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 agre...
// 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 ...
/* * Copyright (C) 2020 Zixiao Han */ mod bitboard; mod bitmask; mod def; mod eval; mod hashtable; mod mov_table; mod prng; mod search; mod state; mod simple_rnd; mod time_control; mod uci; mod util; mod zob_keys; use prng::XorshiftPrng; use state::State; use search::SearchEngine; use time_control::TimeCapacity; us...
//! Futures integration. use crate::stream::Stream; use crate::sync::Mutex; use std::future::Future; use std::mem; use std::pin::Pin; use std::sync::Arc; use std::task::{Context, Poll, Waker}; /// The state a stream future. #[derive(Debug)] enum FutureValue<T> { Pending, Ready(T), Finished, } /// The sto...
use idroid::geometry::plane::Plane; use idroid::{node::ImageNodeBuilder, node::ImageViewNode, MVPUniformObj}; use nalgebra_glm as glm; use wgpu::Extent3d; use zerocopy::{AsBytes, FromBytes}; pub struct SDFRenderNode { extent: Extent3d, scale: f32, view_node: ImageViewNode, mvp_buf: MVPUniformObj, } #...
use crate::progenitor; use crate::RoleAssignment; use crate::ADMIN_ROLE_NAME; use crate::AGENT_TO_ASSIGNMENT_LINK_TYPE; use hdk::holochain_core_types::time::{Iso8601, Timeout}; use hdk::prelude::*; use holochain_wasm_utils::api_serialization::get_entry::GetEntryResultItem; use std::convert::TryFrom; /** * Validates t...
#[doc = r"Value to write to the register"] pub struct W { bits: u32, } impl super::CALLD0 { #[doc = r"Writes to the register"] #[inline(always)] pub fn write<F>(&self, f: F) where F: FnOnce(&mut W) -> &mut W, { self.register.set( f(&mut W { bits: Self:...
pub fn serve() {} pub fn desk() {}
// 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. //! Helper builder for constructing a `CobaltEvent`. use { crate::traits::AsEventCodes, fidl_fuchsia_cobalt::{CobaltEvent, CountEvent, EventPayloa...
// 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 { fidl_fuchsia_wlan_service::WlanMarker, fuchsia_component::client::connect_to_service, wlan_common::mac::Bssid, wlan_hw_sim::*, }; /// Te...
#[cfg(all(not(target_arch = "wasm32"), test))] mod test; use anyhow::*; use liblumen_alloc::erts::exception; use liblumen_alloc::erts::process::Process; use liblumen_alloc::erts::term::prelude::*; use crate::erlang::iolist_or_binary; #[native_implemented::function(erlang:list_to_binary/1)] pub fn result(process: &P...
use super::*; use std::ops::{Deref, DerefMut}; pub(super) struct BinaryTree<L> { pub(super) left: Option<L>, pub(super) right: Option<L> } impl<L> BinaryTree<L> { fn make_fan(depth: usize) -> Self where L: NewLink<Self> { let mut fan = Self { left: None, right: None }; if...
#[doc = r"Value read from the register"] pub struct R { bits: u8, } #[doc = r"Value to write to the register"] pub struct W { bits: u8, } impl super::TXCSRL2 { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'...
use crate::pesel_parsing_error::PeselError; use std::str::FromStr; use rand::Rng; use rand::prelude::ThreadRng; const PESEL_LENGTH: usize = 11; /// Enum to represent Male/Female #[derive(Debug, PartialEq, Copy, Clone)] pub enum PeselGender { Male, Female, } impl std::fmt::Display for PeselGender { fn fm...
use crate::{ builtins::{PyBaseExceptionRef, PyBytesRef, PyStr, PyStrRef, PyTuple, PyTupleRef}, common::{ascii, lock::PyRwLock}, convert::ToPyObject, function::PyMethodDef, AsObject, Context, PyObject, PyObjectRef, PyPayload, PyResult, TryFromObject, VirtualMachine, }; use std::{borrow::Cow, collecti...
// Copyright 2014 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::prelude::v1::*; use gzip_header::*; use std::io::Cursor; fn roundtrip_inner(use_crc: bool) { const COMMENT: &'static [u8] = b"Comment"; const FILENAME: &'static [u8] = b"Filename"; const MTIME: u32 = 12345; const OS: FileSystemType = FileSystemType::NTFS; const XFL: ExtraFlags = ExtraFlags...
extern crate cderive; use cderive::clang::*; use std::env; struct CycleCollect; macro_rules! try_opt { ($e:expr) => { try_opt!($e, return None) }; ($e:expr, $other:expr) => { match $e { Some(x) => x, None => $other, } }; } // Gets the target type of a ...
use crate::account::*; use crate::asset::*; use crate::rate::*; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use borsh::{BorshDeserialize, BorshSerialize}; #[derive(Clone, Serialize, Deserialize, BorshDeserialize, BorshSerialize)] pub struct Agent { pub account: Account, pub is_alive: bo...
use std::collections::HashSet; use proconio::{input, marker::Bytes}; fn main() { input! { h: usize, w: usize, a: [Bytes; h], }; let mut row = vec![vec![0; 26]; h]; for i in 0..h { for j in 0..w { row[i][(a[i][j] - b'a') as usize] += 1; } } l...