text
stringlengths
8
4.13M
#[derive(Copy, Clone, PartialEq, Debug)] #[repr(C)] pub struct Quat { x: f32, y: f32, z: f32, w: f32, } #[derive(Copy, Clone, PartialEq, Debug)] #[repr(C)] pub struct Vec3 { x: f32, y: f32, z: f32, } impl Vec3 { #[inline] pub const fn new(x: f32, y: f32, z: f32) -> Self { S...
/* * Datadog API V1 Collection * * Collection of all Datadog Public endpoints. * * The version of the OpenAPI document: 1.0 * Contact: support@datadoghq.com * Generated by: https://openapi-generator.tech */ /// UsageSyntheticsBrowserHour : Number of Synthetics Browser tests run for each hour for a given organi...
// Copyright 2018-2020 Parity Technologies (UK) Ltd. // This file is part of Substrate. // Substrate 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) a...
extern crate somepackage; use somepackage::indirect_access; use somepackage::somemod; // import from other local file mod otherfile; // import c code extern { fn c_function_example(); } use otherfile::mod_in_otherfile; fn main() { println!("Hello, world!"); somepackage::public_function(); indirect_acce...
#![no_std] #![feature(start)] #![no_main] use ferr_os_librust::syscall; use ferr_os_librust::io; extern crate alloc; use alloc::string::{String, ToString}; #[no_mangle] pub extern "C" fn _start(heap_address: u64, heap_size: u64, _args: u64) { unsafe { syscall::set_screen_size(1, 10); syscall::se...
use std::collections::HashMap; use std::io; use crate::base::Part; pub fn part1(r: &mut dyn io::Read) -> Result<String, String> { solve(r, Part::One) } pub fn part2(r: &mut dyn io::Read) -> Result<String, String> { solve(r, Part::Two) } fn solve(r: &mut dyn io::Read, part: Part) -> Result<String, String> { ...
pub mod checklists; pub mod requirements;
//! Traits and code for emitting high-level structures as low-level, raw wasm //! structures. E.g. translating from globally unique identifiers down to the //! raw wasm structure's index spaces. use crate::encode::{Encoder, MAX_U32_LENGTH}; use crate::ir::Local; use crate::map::{IdHashMap, IdHashSet}; use crate::{Code...
use crate::components::{TileMap, TileMapConfig}; use crate::resources::{get_screen_size, Board, Context, Game, State}; use crate::states::MainState; use amethyst::{ core::Transform, prelude::*, renderer::Camera, assets::{ Prefab, PrefabLoader, RonFormat, Handle, ...
pub fn z_encode(s: &str) -> Option<String> { let mut ret = String::with_capacity(s.len() * 2); let mut chars = s.chars(); let mut next = chars.next(); while let Some(c) = next { match c { '(' => { next = chars.next(); // consume '(' let mut consumed ...
use git2::Repository; fn main() { let repo = match Repository::init("/tmp/hello.git") { Ok(repo) => repo, Err(e) => panic!("failed to init: {}", e), }; println!("success init repo"); }
extern crate env_logger; // #[macro_use] // extern crate log; use fastping_rs::Pinger; use timer::Timer; use chrono::Duration; use nix::unistd::{setuid, Uid}; use std::sync::mpsc; use std::env; use influent::client::Credentials; mod log; mod ping_result; use ping_result::PingResult; mod pinger; use pinger::run_ping; ...
#![crate_name = "server"] #![crate_type = "bin"] #![allow(dead_code)] extern crate debug; extern crate nanomsg; use std::io::Writer; use nanomsg::AF_SP; use nanomsg::NN_PAIR; use nanomsg::NanoSocket; fn main() { let socket_address = "tcp://127.0.0.1:5555"; println!("server binding to '{:?}'", socket_address...
extern crate spidy; extern crate diesel; use self::spidy::*; use self::models::*; use self::diesel::prelude::*; fn main() { use spidy::schema::movies::dsl::*; let connection = establish_connection(); let results = movies.filter(published.eq(true)) .limit(5) .load::<Movie>(&connection) ...
use shopsite_aa::de as aa; use std::{ fs::{File, OpenOptions}, io::{self, BufRead, BufReader, Write}, num::NonZeroU8, path::PathBuf, process::exit, rc::Rc }; use structopt::StructOpt; #[derive(StructOpt)] #[structopt( about = "Converts a ShopSite `.aa` file to JSON." )] struct Opts { /// Pretty-print the outpu...
use std::sync::{Arc, Mutex}; use std::thread; use std::thread::JoinHandle; fn closure_() { let example_closure = |x| x; let s = example_closure(String::from("hello")); // type of x is set to String after this line // let n = example_closure(5); // 5 | let n = example_closure(5); // | ...
use nails_derive::Preroute; #[derive(Preroute)] #[nails(path = "/api/posts/{id}", foo)] pub struct GetPostRequest {} #[derive(Preroute)] #[nails(path = "/api/posts/{id}")] pub struct GetPostRequest2 { #[nails(query, foo)] query1: String, } fn main() {}
// Copyright 2017 Dmitry Tantsur <divius.inside@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 ap...
use models::*; use misc; use std::collections::HashMap; pub fn search_results(search_results: &Vec<SearchResult>) -> Vec<SearchResultFlat> { let mut search_results_flat: Vec<SearchResultFlat> = Vec::new(); for search_result in search_results { //flatten organism let taxon_code; let spe...
use std::rc::Rc; pub type Getter<S, A> = dyn Fn(&S) -> A; pub type Setter<S, A> = dyn Fn(&mut S, A); pub struct Lens<S, A> { pub view: Rc<Getter<S, A>>, pub set: Rc<Setter<S, A>>, } pub fn lens<'a, S, A>(getter: Rc<Getter<S, A>>, setter: Rc<Setter<S, A>>) -> Lens<S, A> { Lens { vie...
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::{ access_path::AccessPath, account_config::constants::{ association_address, type_tag_for_currency_code, CORE_CODE_ADDRESS, }, event::EventHandle, }; use anyhow::Result; use move_core_types::account_a...
use std::collections::HashMap; fn main() { let mut scores = HashMap::new(); scores.insert(String::from("Blue"), 10); scores.insert(String::from("Yellow"), 50); let teams = vec![String::from("Blue"), String::from("Yellow")]; let initial_scores = vec![10, 50]; let scores_2: HashMap<_, _> = tea...
//! SRT Source stream mod decoder; pub mod filters; mod graph; mod media_stream; mod srt_source; mod stream_descriptor; pub use decoder::Decoder; pub use srt_source::SrtSource; pub use stream_descriptor::StreamDescriptor;
// Copyright 2020 Parity Technologies (UK) Ltd. // This file is part of Substrate. // Parity 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...
use { proc_macro2::{Span, TokenStream}, quote::{quote, ToTokens, TokenStreamExt}, std::collections::HashSet, syn::parse, }; #[derive(Debug)] pub struct PathImplInput { module: syn::Path, comma: syn::Token![,], path: syn::LitStr, } impl parse::Parse for PathImplInput { fn parse(input: p...
/// An enum to represent all characters in the CJKCompatibilityForms block. #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum CJKCompatibilityForms { /// \u{fe30}: '︰' PresentationFormForVerticalTwoDotLeader, /// \u{fe31}: '︱' PresentationFormForVerticalEmDash, /// \u{fe32}: '︲' Prese...
use crate::{http, Request, Response}; #[cfg(feature = "https")] use rustls::{self, ClientConfig, ClientSession}; use std::env; use std::io::{BufReader, BufWriter, Error, ErrorKind, Read, Write}; use std::net::{TcpStream, ToSocketAddrs}; #[cfg(feature = "https")] use std::sync::Arc; use std::time::Duration; #[cfg(featur...
#![doc = "generated by AutoRust 0.1.0"] #![allow(non_camel_case_types)] #![allow(unused_imports)] use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct JobStream { #[serde(default, skip_serializing_if = "Option::is_none")] pub id: Option<String>, #[serde(...
use crate::errors::MetaphraseError; use crate::models::*; use actix_web::HttpRequest; use time::OffsetDateTime; pub fn current_user(req: &HttpRequest) -> Result<User, MetaphraseError> { let extensions = req.extensions(); let current_session = extensions.get::<Session>().unwrap(); current_session.user() } ...
use std::fmt::Debug; #[derive(Debug)] struct Ref<'a, T: 'a>(&'a T); // Ref contains a reference to a generic type T // that has an unknown lifetime 'a. // T is bounded such that any reference in T // must outlibe 'a. // Additionally the lifetime of Ref may not exceed 'a. fn print<T>(t: T) where T: Debug { pri...
#[doc = "Register `SYSCFG_ITLINE3` reader"] pub type R = crate::R<SYSCFG_ITLINE3_SPEC>; #[doc = "Field `FLASH_ITF` reader - Flash interface interrupt request pending"] pub type FLASH_ITF_R = crate::BitReader; impl R { #[doc = "Bit 1 - Flash interface interrupt request pending"] #[inline(always)] pub fn flas...
use std::collections::HashMap; use std::collections::HashSet; use crate::util; pub fn solve() { let input_file = "input-day-3.txt"; println!("Day 3 answers"); print!(" first puzzle: "); let answer = solve_first_file(input_file); println!("{}", answer); print!(" second puzzle: "); let ans...
use crate::problem_datatypes::Solution; use crate::problem_datatypes::DataPoints; use crate::problem_datatypes::Constraints; use crate::fitness_evolution::FitnessEvolution; use crate::arg_parser::ProgramParameters; use crate::utils; use crate::arg_parser::SearchType; use crate::algorithms::local_search; use crate::algo...
#![doc = "generated by AutoRust 0.1.0"] #![allow(non_camel_case_types)] #![allow(unused_imports)] use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct CertificateAttributes { #[serde(flatten)] pub attributes: Attributes, #[serde(rename = "recoverableDays...
use crate::{ buffer::{CellBuffer, Contacts, Span}, fragment, fragment::{Arc, Circle}, Cell, Point, Settings, }; use indexmap::IndexMap; use once_cell::sync::Lazy; use std::{ collections::{BTreeMap, HashMap}, iter::FromIterator, }; /// skip the first 3 circles for constructing our arcs, otherwis...
use crate::headers::{HeaderName, HeaderValue, Headers, EXPECT}; use crate::{ensure_eq_status, headers::Header}; use std::fmt::Debug; /// HTTP `Expect` header /// /// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expect) /// /// # Specifications /// /// - [RFC 7231, section 5.1.1: Expec...
use std::collections::HashSet; use crate::utils::file2vec; pub fn day24(filename:&String){ let contents = file2vec::<String>(filename); let contents:Vec<String> = contents.iter() .filter_map(|x| { match x { Ok(line) => { if !line.is_empty(){ Some(lin...
use std::thread; use std::net::{TcpListener, TcpStream}; use std::io::{Read, Write}; use std::fs; use std::str; //for parsing TCP stream fn main() { listen_connection(); } fn listen_connection(){ let port = match get_port(){ Some(v) => v, None => return, }; let listener = TcpListener::...
use super::types; use super::{Error, Header, SectionContent}; use num_traits::FromPrimitive; use std::io::Read; #[derive(Debug, Clone)] pub enum DynamicContent { None, String((Vec<u8>, Option<u64>)), Address(u64), Flags1(types::DynamicFlags1), } impl Default for DynamicContent { fn default() -> Se...
use super::ide; use super::BLK_SIZE; use crate::lock::sleep::{SleepMutex, SleepMutexGuard}; use crate::lock::spin::SpinMutex; use alloc::boxed::Box; use alloc::collections::BTreeMap; use core::sync::atomic::{AtomicU8, Ordering}; use lazy_static::lazy_static; /// buffer has been read from disk const B_VALID: u8 = 0x2; ...
use std::old_io as io; use std::collections::HashMap; fn main() { // Read numbers let (n,m) = get_nums(); // Fill cache up to n: let mut fibs = HashMap::with_capacity(n as usize); { let mut fib: Fibonacci = Fibonacci{ curr: 1, next:0}; for (i, num) in fib.take((n + 1) as usize).enumerate() { ...
use libp2p::core::upgrade::ReadyUpgrade; use libp2p::swarm::handler::ConnectionEvent; use libp2p::swarm::{ConnectionHandler, ConnectionHandlerEvent, KeepAlive, SubstreamProtocol}; use libp2p::StreamProtocol; use std::error::Error; use std::fmt; use std::task::{Context, Poll}; use void::Void; /// Connection handler for...
#[doc = "Register `CRH` reader"] pub type R = crate::R<CRH_SPEC>; #[doc = "Register `CRH` writer"] pub type W = crate::W<CRH_SPEC>; #[doc = "Field `MODE8` reader - Port n.8 mode bits"] pub type MODE8_R = crate::FieldReader<MODE8_A>; #[doc = "Port n.8 mode bits\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, Partial...
extern crate bulletrs; extern crate cgmath; use cgmath::{Vector3, Vector4}; use bulletrs::*; #[test()] fn set_get_user_index() { let configuration = CollisionConfiguration::new_default(); let mut dynamics_world = DynamicsWorld::new_discrete_world( CollisionDispatcher::new(&configuration), Br...
use crate::*; #[derive(Encode, Decode, Clone, RuntimeDebug, PartialEq, Eq)] #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] #[cfg_attr(feature = "std", serde(rename_all = "camelCase"))] pub struct Asset<AssetId, AssetBalance> { pub id: AssetId, pub amount: AssetBalance, } impl<AssetId, AssetBalan...
use crate::enums::{Align, Color, ColorDepth, Cursor, Font, FrameType, Shortcut}; use crate::image::RgbImage; use crate::prelude::*; use crate::utils::FlString; use fltk_sys::draw::*; use std::ffi::{CStr, CString}; use std::mem; use std::os::raw; /// Defines a coordinate of x and y #[derive(Copy, Clone, Debug)] pub str...
//! Easy use of buttons. use peripheral; /// The user button. pub static BUTTONS: [Button; 1] = [Button { i: 0 }]; /// A single button. pub struct Button { i: u8, } impl Button { /// Read the state of the button. pub fn pressed(&self) -> bool { let idr = &peripheral::gpioa().idr; match ...
pub mod almost_infinite; pub mod gillespie;
use std::fs; use nom::{ branch::alt, bytes::complete::tag, character::complete::{char, digit1, line_ending}, combinator::{map, map_res}, multi::separated_list1, sequence::{preceded, terminated}, IResult, }; #[derive(Debug)] enum Operation { Add(usize), Multiply(usize), Multiply...
fn main() { let s1 = String::from("Hello World!"); let s2 = s1; // println!("s1={}", s1) let s3 = s2.clone(); println!("s2={},s3={}", s2, s3); let s = String::from("Hello"); takes_ownership(s); // println!("s={}",s); let x = 5; makes_copy(x); let str1 = give_ownershi...
use aoc_runner_derive::aoc_main; aoc_main! { lib = advent_of_code }
use super::session::Session; use super::tmux::*; use crate::config::Config; use fuzzy_matcher::skim::SkimMatcherV2; use fuzzy_matcher::FuzzyMatcher; use std::error::Error; use tui::backend::Backend; use tui::layout::Rect; use tui::style::{Modifier, Style}; use tui::widgets::{Block, Borders, List, ListState, Text}; us...
use std::str::FromStr; #[derive(Debug, PartialEq, Clone)] pub struct Token { pub kind: TokenKind, pub position: Position, } pub type Position = (usize, usize); #[derive(Debug, PartialEq, Clone)] pub enum TokenKind { EOF, Symbol(Symbol), Comment(String), IntLiteral(u64), FloatLiteral(f64),...
use std::fmt; struct MinMax(i64, i64); impl fmt::Display for MinMax { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "({}, {})", self.0, self.1) } } struct Point2D { x: f64, y: f64, } impl fmt::Display for Point2D { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {...
extern crate env_logger; use limn::prelude::*; use limn::input::{EscKeyCloseHandler, DebugSettingsHandler}; use limn::resources; use limn::resources::font::FontDescriptor; use limn::draw::rect::RectStyle; use limn::draw::text::TextStyle; use limn::draw::ellipse::EllipseStyle; use limn::widgets::slider::*; pub fn defa...
mod binary; use std::cmp::Ordering; pub fn solve_1() { let max_seat_id = include_str!("input.txt") .trim() .lines() .map(binary::parse) .map(|instructions| binary::seat_id(binary::calculate_seat(&instructions))) .max() .unwrap(); println!("Max seat ID of all boarding passes: {}", max_seat_id); } pub f...
use iced::{Element, Sandbox, Settings, Text}; pub fn main() -> iced::Result { Hello::run(Settings::default()) } struct Hello; impl Sandbox for Hello { type Message = (); fn new() -> Hello { Hello } fn title(&self) -> String { String::from("A moldy application") } fn upd...
use common::result::Result; use crate::application::dtos::{AuthorDto, CategoryDto, PublicationDto}; use crate::domain::author::{AuthorId, AuthorRepository}; use crate::domain::category::CategoryRepository; use crate::domain::publication::PublicationRepository; pub struct GetById<'a> { author_repo: &'a dyn AuthorR...
use alloc::{collections::BTreeMap, vec::Vec}; use core::{ cmp::{max, Ordering}, fmt::Debug, hash::{Hash, Hasher}, ops::{Bound, Index, RangeBounds}, }; use crate::segment::{Segment, Start}; pub(crate) use key::Key; pub mod iterators; mod key; #[cfg(test)] mod tests; /// # SegmentMap /// /// A map of ...
use rsocket_rust::Result; use serde::{de::DeserializeOwned, Serialize}; pub trait SerDe { fn marshal<T>(&self, data: &T) -> Result<Vec<u8>> where Self: Sized, T: Sized + Serialize; fn unmarshal<T>(&self, raw: &[u8]) -> Result<T> where Self: Sized, T: Sized + Deserialize...
use super::agent_vnet_test::*; use super::*; use crate::candidate::candidate_base::*; use crate::candidate::candidate_host::*; use crate::candidate::candidate_peer_reflexive::*; use crate::candidate::candidate_relay::*; use crate::candidate::candidate_server_reflexive::*; use crate::control::AttrControlling; use crate:...
mod callbacks; pub mod config; //pub struct Session { raw: *mut sp_session }
use sodiumoxide::crypto::box_::curve25519xsalsa20poly1305; use std::path::Path; /// Core errors. #[derive(Debug, Fail)] pub enum Error { /// TODO(refactor): Improve error types. #[fail(display = "CoreError::Unwrap")] Unwrap, /// sodiumoxide initialisation error. #[fail(display = "SodiumoxideInit::U...
// Copyright (c) 2021 asisdrico <asisdrico@outlook.com> // // Licensed under the MIT license // <LICENSE or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. //! trsh server is the server component of the tiny rust shell //...
mod models; pub use self::models::{ChecklistModel, ChecklistHierarchy};
use super::*; use std::str::from_utf8; use std::io::Read; pub struct ImportSection<'a>(pub &'a [u8], pub usize); pub struct ImportEntryIterator<'a>(&'a [u8], usize); pub struct ImportEntry<'a> { pub module: &'a str, pub field: &'a str, pub contents: ImportEntryContents, } pub enum ImportEntryContents { ...
use crate::day9::{intcode_computer, parse_program}; use std::collections::HashMap; #[aoc_generator(day13)] fn day13_gen(input: &str) -> Vec<i64> { parse_program(input) } #[aoc(day13, part1)] fn solve_p1(tape: &[i64]) -> usize { let mut tape = tape.to_owned(); let mut screen = HashMap::new(); let mut...
use crate::mt19937::{B, C, L, S, T, U}; use std::u32; // The following were cribbed from https://jazzy.id.au/2010/09/22/cracking_random_number_generators_part_3.html // I managed the xor parts on my own, but TBH I still don't completely understand how the mask stuff works fn unbitshift_right_xor(v: u64, shift: usize) ...
use num::integer::lcm; use util::*; fn main() -> Result<(), Box<dyn std::error::Error>> { let timer = Timer::new(); let buses: Vec<Option<usize>> = input::lines::<String>(&std::env::args().nth(1).unwrap())[1] .split(',') .map(|n| n.parse::<usize>().ok()) .collect(); let mut offsets...
use crate::glsl::Glsl; use std::convert::{TryFrom, TryInto}; use syn::spanned::Spanned; use syn::{Error, Result}; #[derive(Debug, Clone)] pub enum YaslScalarType { Int, UInt, Float32, Float64, Bool, } impl TryFrom<syn::Type> for YaslScalarType { type Error = Error; fn try_from(ty: syn::Type...
#[derive(Serialize, Deserialize, Debug)] pub struct Stats { pub read: String, pub network: Network, pub memory_stats: MemoryStats, pub cpu_stats: CpuStats, pub blkio_stats: BlkioStats, } #[derive(Serialize, Deserialize, Debug)] pub struct Network { pub rx_dropped: u64, pub rx_bytes: u64, ...
use crate::command_prelude::*; use cargo::ops; pub fn cli() -> App { subcommand("login") .about( "Save an api token from the registry locally. \ If token is not specified, it will be read from stdin.", ) .arg(opt("quiet", "No output printed to stdout").short("q")) ...
use crate::error::Error; use async_trait::async_trait; use futures::TryStreamExt; const NAME_PREFIX: &str = "emu."; #[derive(Debug, Clone)] pub struct Network { name: String, index: u32, } #[derive(Debug, Clone)] pub struct Interface { name: String, peer_name: String, index: u32, id: u32, } ...
/** * Authors: Jorge Martins && Diogo Lopes * This example is from Vasconcelos, V.T. (and several others): * "Behavioral Types in Programming Languages" (figures 2.4, 2.5 and 2.6) */ //Messages to be traded use crate::customer; use chrono::prelude::*; use std::fmt::{self, Display, Formatter}; pub enum Decision { A...
#![no_main] #![no_std] extern crate cortex_m_rt; extern crate panic_halt; use cortex_m_rt::entry; #[entry] fn foo() {} //~^ ERROR `#[entry]` function must have signature `[unsafe] fn() -> !`
#![cfg(feature = "use-hyper")] use crate::error::Error; use crate::client::Client; use hyper::rt::{Future, Stream}; use hyper_tls::HttpsConnector; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug)] pub struct HyperClient { node: String, } impl HyperClient { pub fn new(node: &str) -> Self { S...
//! Various state of the authenticator. //! //! Needs cleanup. use ctap_types::{ cose::EcdhEsHkdf256PublicKey as CoseEcdhEsHkdf256PublicKey, // 2022-02-27: 10 credentials sizes::MAX_CREDENTIAL_COUNT_IN_LIST, // U8 currently Bytes, Error, String, }; use trussed::{ client, syscall, try_syscal...
// q0028_implement_strstr struct Solution; impl Solution { pub fn str_str(haystack: String, needle: String) -> i32 { match haystack.find(needle.as_str()) { Some(n) => n as i32, None => -1, } } } #[cfg(test)] mod tests { use super::Solution; #[test] fn it_w...
#![allow(non_snake_case)] //! Mailbox Module use core::ffi::c_void; use std::ffi::CString; use std::io::{Error, ErrorKind}; use std::mem::size_of; // use std::fs::OpenOptions; // use std::{io, ptr}; use libc; pub mod ioctl; /* from https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface */ pub const...
pub mod error; mod expressions; mod ident; mod items; mod path; mod patterns; mod types; use crate::{db::HirDatabase, ids::HirTables, lower::error::LoweringError}; use valis_source::File; pub struct LoweringCtx<'a, DB> { pub db: &'a DB, pub source_file: File, } impl<'a, DB: HirDatabase> LoweringCtx<'a, DB> {...
use crate::queue::DrawQueue; use crate::shared_res::SharedResources; use glium::glutin::dpi::PhysicalPosition; use glium::glutin::event_loop::EventLoop; use glium::glutin::window::WindowId; use rtk::event::Event; use rtk::toplevel::{TopLevel, WindowAttributes}; use rtk_winit::{make_win_builder, BackendWindow}; use std:...
use crate::grid::{Cell, Grid}; use terminal::util::Point; pub fn fill(grid: &mut Grid, point: Point, first_cell: Cell, fill_cell: Cell) { let cell = grid.get_mut_cell(point); // We want to fill multiple measured cells as one, regardless of the index let measured_cell = matches!(*cell, Cell::Measur...
use serde::{Deserialize, Serialize}; #[derive(Debug, Serialize, Deserialize)] pub struct JrpcMessage { pub jsonrpc: String, pub method: String, #[serde(default)] pub id: Option<usize>, pub params: serde_json::Value, } #[derive(Debug, Serialize, Deserialize)] pub struct JrpcResponse { pub jsonr...
use core::marker::PhantomData; use crate::pac; use crate::pac::common::{Reg, RW}; use crate::pac::SIO; use crate::peripherals; use embassy::util::Unborrow; use embassy_extras::{unborrow, unsafe_impl_unborrow}; use embedded_hal::digital::v2 as digital; /// Represents a digital input or output level. #[derive(Debug, E...
use diesel::prelude::{QueryDsl, RunQueryDsl}; use sl_lib::*; // delete it later and use filter for tera with rocket later instead use sl_lib::custom::{str_from_stdin}; use console::Style; // // delete all in SQL -> DELETE FROM users; pub fn delete() { let yellow = Style::new().yellow(); let bold = Style::ne...
///! An item is line of text that read from `find` command or stdin together with ///! the internal states, such as selected or not use std::cmp::min; use std::default::Default; use std::ops::Deref; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; use crate::spinlock::{SpinLock, SpinLockGuard}; use ...
/* * Datadog API V1 Collection * * Collection of all Datadog Public endpoints. * * The version of the OpenAPI document: 1.0 * Contact: support@datadoghq.com * Generated by: https://openapi-generator.tech */ /// UsageAttributionAggregatesBody : The object containing the aggregates. #[derive(Clone, Debug, Par...
extern crate bincode; extern crate solana_program_interface; use bincode::deserialize; use solana_program_interface::account::KeyedAccount; #[no_mangle] pub extern "C" fn process(keyed_accounts: &mut Vec<KeyedAccount>, data: &[u8]) -> bool { let tokens: i64 = deserialize(data).unwrap(); if keyed_accounts[0].a...
extern crate dotenv; extern crate iron; extern crate mount; extern crate router; extern crate iron_sessionstorage; extern crate urlencoded; extern crate serde_json; extern crate iron_test; mod utils; mod routes; use dotenv::dotenv; use iron::prelude::{Iron, Chain}; use iron_sessionstorage::SessionStorage; use iron_s...
use std::collections::{HashMap, HashSet}; fn parse_rule(r: &str) -> (String, String, i32) { let mut parts = r.split(' '); let name = parts.next().unwrap().to_owned(); parts.next(); let change = parts.next().unwrap(); let delta: i32 = parts.next().unwrap().parse().unwrap(); let delta = if cha...
// Implemented outside of windows-service as it's somewhat special-case // // TODO: check a lot of careless stuff in here, I didn't understand absolute vs. // self-relative Security Descriptors at the time I wrote it. Probably a number // of double-frees around. use std::ffi::OsStr; use std::ptr::{null, null_mut}; us...
use crate::{PieceType, PlayerColor}; use super::DenseBoard; use rand::distributions::{Distribution, Standard}; use rand::seq::SliceRandom; use rand::Rng; /// Defines a random generator for Paco Ŝako games that are not over yet. /// I.e. where both kings are still free. This works by placing the pieces /// randomly on...
extern crate crc; extern crate memmap; extern crate byteorder; pub mod storage; fn main() {}
use amethyst::{ assets::PrefabData, derive::PrefabData, ecs::{Component, DenseVecStorage, Entity, WriteStorage}, Error, }; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] pub enum LogicModule { SillyRun, EngineRunner(String), } #[derive(Clone,...
use super::*; #[test] fn test_decode_sb_immediate() { let predicted_imm = decode_sb_immediate(&[0x63,0x2,0x0,0x0]); println!("Decoded: {:032b}\n Actual: {:032b}", predicted_imm, 4); assert_eq!(predicted_imm, 4); let predicted_imm = decode_sb_immediate(&[0xe3, 0x0e, 0x00, 0xfe]); println!("Decoded...
#[doc = "Register `DDRCTRL_DRAMTMG5` reader"] pub type R = crate::R<DDRCTRL_DRAMTMG5_SPEC>; #[doc = "Register `DDRCTRL_DRAMTMG5` writer"] pub type W = crate::W<DDRCTRL_DRAMTMG5_SPEC>; #[doc = "Field `T_CKE` reader - T_CKE"] pub type T_CKE_R = crate::FieldReader; #[doc = "Field `T_CKE` writer - T_CKE"] pub type T_CKE_W<...
// q0114_flatten_binary_tree_to_linked_list struct Solution; use crate::util::TreeNode; use std::cell::RefCell; use std::rc::Rc; impl Solution { pub fn flatten(root: &mut Option<Rc<RefCell<TreeNode>>>) { Solution::flatten_tree(root.clone()); } fn flatten_tree( tree: Option<Rc<RefCell<Tre...
/// An enum to represent all characters in the Manichaean block. #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum Manichaean { /// \u{10ac0}: '𐫀' LetterAleph, /// \u{10ac1}: '𐫁' LetterBeth, /// \u{10ac2}: '𐫂' LetterBheth, /// \u{10ac3}: '𐫃' LetterGimel, /// \u{10ac4}:...
use super::base::*; use super::super::hw::HW; impl CPU { pub fn io_inb(&mut self, port: u16, hw: &mut HW) -> u8 { match port { 0x60 => { match hw.keyboard.io_get_scancode() { Some(scancode) => scancode, None => 0x0 } } 0x61 => hw.keyboard.get_ppi_a(), 0x3da => { hw.dis...
// Copyright 2021 MaidSafe.net limited. // // This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT // https://opensource.org/licenses/MIT> or the Modified BSD license <LICENSE-BSD // https://opensource.org/licenses/BSD-3-Clause>, at your option. This file may not be copied, // modified, or d...