text
stringlengths
8
4.13M
mod ident; mod typeck; mod eval; mod repl; mod parser; mod syntax; mod multi_result; mod alpha; mod names; mod prelude; mod input; mod coordinates; fn main() { println!("{:?}", repl::repl()); }
#![recursion_limit = "1024"] use clap::{App, AppSettings, Arg}; use log::{info, warn}; use nix::{sys::stat, unistd}; use std::{ cell::RefCell, env, net::{IpAddr, SocketAddr}, rc::Rc, }; use tokio::{prelude::*, process::Command}; mod broker; mod client; mod error; mod server; use error::*; use server::S...
use clap::{crate_version, value_t, App, Arg}; use nix::mount::{mount, MsFlags}; use nix::sched::{clone, CloneFlags}; use nix::sys::signal::Signal; use nix::sys::wait::waitpid; use nix::unistd::execvp; use std::ffi::{CStr, CString}; use std::fs::create_dir_all; use std::process; const NONE: Option<&'static [u8]> = None...
#![deny(warnings)] extern crate getopts; use std::{env, io}; use std::io::{Read, Write}; use std::error::Error; use getopts::Options; mod error; mod options; use options::{DeleteOption, GitOptions}; mod branches; use branches::Branches; mod commands; use commands::*; const VERSION: &'static str = env!("CARGO_PK...
use std::io; fn main() { let mut x1 = String::new(); let mut x2 = String::new(); let mut flag = String::new(); while true { println!("Enter Your Choice from 1 to 5"); println!("1. Add"); println!("2. Subtract"); println!("3. Multiply"); println!("4. Divide"); ...
// Copyright (C) 2017 1aim GmbH // // 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 wr...
use stmt::{ property::Property, fun::Fun, local::Local, Statement, StatementKind }; use ir::{ Chunk, hir::HIRInstruction, }; use super::{ Typeck, Load, Unload, }; use ir_traits::ReadInstruction; use notices::{ DiagnosticLevel, DiagnosticSourceBuilder, }; impl Load for...
use apllodb_sql_parser::apllodb_ast; use crate::select::ordering::Ordering; use super::AstTranslator; impl AstTranslator { pub fn ordering(ast_ordering: Option<apllodb_ast::Ordering>) -> Ordering { match ast_ordering { None | Some(apllodb_ast::Ordering::AscVariant) => Ordering::Asc, ...
use hex; use hex::ToHex; use nes::console::Console; use std::fmt; use std::fmt::Debug; use std::ops::Deref; #[derive(PartialEq)] struct DebugLowerHex<T>(T); impl<T: AsRef<[u8]>> fmt::Debug for DebugLowerHex<T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", hex::encode(&self.0...
#![feature(asm)] use std::cmp::Ordering; use std::str::from_utf8_unchecked; fn main() { let s = "Enter you guess: "; let mut buf = [0u8; 16]; let mut bytes_written: usize; let mut rando_buf = [0u8; 8]; let fd: u32; // fd for /dev/urandom let filename = "/dev/urandom\0"; unsafe { ...
#[macro_use] extern crate diesel; #[macro_use] extern crate serde_derive; pub mod models; pub mod schema; pub mod utils;
use indicatif::ProgressBar; /// Functions that export a list of pulls to a file use std::{fs::File, io, io::Write, path::Path}; use crate::{data_type::Pull, style::SPINNER_STYLE}; /// export a list of pulls into a csv file pub fn export_csv(results: &[Pull], path: &Path) -> io::Result<()> { let pb = ProgressBar::...
use libc::{c_void, size_t}; use H5Fpublic::H5F_mem_t; use H5public::herr_t; pub type H5FD_mem_t = H5F_mem_t; #[derive(Clone, Copy, Debug)] #[repr(C)] pub enum H5FD_file_image_op_t { H5FD_FILE_IMAGE_OP_NO_OP, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_SET, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY, H5FD_FILE_IMAGE_...
mod create_filesystem_response; mod delete_filesystem_response; mod get_filesystem_properties_response; mod list_filesystems_response; mod set_filesystem_properties_response; pub use self::create_filesystem_response::CreateFilesystemResponse; pub use self::delete_filesystem_response::DeleteFilesystemResponse; pub use s...
use crate::error::ErrorMessage; use rocket_contrib::json::Json; #[catch(500)] pub fn internal_server_error() -> Json<ErrorMessage> { Json(ErrorMessage { message: "Something went wrong", ..ErrorMessage::default() }) } #[catch(404)] pub fn not_found_error() -> Json<ErrorMessage> { Json(Error...
use std::sync::atomic::AtomicUsize; use std::sync::atomic::Ordering; use std::sync::Arc; pub trait BrokersPool { fn broker(&self) -> &String; } pub struct StaticPool { brokers: Vec<String>, selection: SelectionStategy, } impl StaticPool { pub fn new(brokers: Vec<String>, stategy: SelectionStategy) ->...
use crate::days::day5::default_input; pub fn run() { println!("{}", boarding_pass_str(default_input()).unwrap()); } pub fn boarding_pass_str(input : &str) -> Result<i64, ()> { Ok(input.lines().map(|l| { let row_indicators = &l[..7]; let col_indicators = &l[7..]; let row = parse_row(row...
use proconio::input; fn main() { input! { a:u32, b:u32, x:u32, } println!("{}", if a <= x && x <= a + b { "YES" } else { "NO" }); }
//! Implements `SimpleSearch`. use std::mem; use std::cmp::max; use std::thread; use std::sync::Arc; use std::sync::mpsc::{Sender, Receiver}; use std::marker::PhantomData; use std::ops::Deref; use uci::{SetOption, OptionDescription}; use value::*; use depth::*; use board::*; use moves::*; use ttable::*; use search::*;...
use std::convert::Infallible; use std::net::SocketAddr; use hyper::{Body, Method, Request, Response, Server, StatusCode, header}; use hyper::service::{make_service_fn, service_fn}; use serde::{Serialize, Deserialize}; use serde_json; #[cfg(test)] mod test; #[derive(Serialize, Deserialize)] struct OutputData { result...
use super::*; use bytes::{Buf, BufMut, Bytes, BytesMut}; /// Return code in connack #[derive(Debug, Clone, Copy, PartialEq)] #[repr(u8)] pub enum ConnectReturnCode { Success = 0, UnspecifiedError = 128, MalformedPacket = 129, ProtocolError = 130, ImplementationSpecificError = 131, UnsupportedPr...
use std::collections::HashMap; use infuse::{request_animation_frame, RenderItem, Renderer, Uniform}; use instant; use wasm_bindgen::prelude::*; use wasm_bindgen::JsCast; use web_sys::{AudioContext, OscillatorType, BiquadFilterType, console}; const VERT: &str = include_str!("./shaders/vert.glsl"); const FRAG: &str = i...
const NUMERALS: [(usize, &str, &str); 4] = [ (1000, "M", "n"), (100, "C", "D"), (10, "X", "L"), (1, "I", "V"), ]; /// Converts a number to a string representating roman numeral. fn num_as_roman(num: i32) -> String { let mut numeral = String::new(); let mut rem = num as usize; let mut ten = "n"; ...
use std::fs; use array2d::Array2D; use vector2d::Vector2D; struct Toboggan { map: Array2D<char>, tree_char: char, slope_dir: Vector2D<usize>, } impl Toboggan { fn new(content: &String, tree_char: char, slope_dir: Vector2D<usize>) -> Self { let lines: Vec<&str> = content.lines().collect(); ...
#![cfg_attr(feature = "no_std", no_std)] pub mod ansi; #[macro_use] mod macros; #[allow(unused_imports)] // Compiler is thinking #[macro_use] is unused #[cfg(not(feature = "std"))] #[macro_use] extern crate alloc; #[cfg(test)] mod tests { use crate::ansi; /// Test the Red struct created by the macro using ...
use std::os::unix::process::CommandExt; use std::path::Path; use std::process::Command; use structopt::StructOpt; use crate::errors::{AppError, AppResultU}; #[derive(Debug, Default, Eq, PartialEq, StructOpt)] pub struct Opt { /// Command line arguments for sqlite3 args: Vec<String>, } pub fn shell<T: As...
use vector::Vector3; use ray::Ray; use std::f64; #[derive(Debug)] pub struct Camera { width: f64, height: f64, pub eye: Vector3<f64>, pub up: Vector3<f64>, pub dir: Vector3<f64>, pub lookat: Vector3<f64>, pub fov: f64, u: Vector3<f64>, v: Vector3<f64>, w: Vector3<f64>, b: V...
#![allow(unused)] fn main() { let machine_kind = if cfg!(unix) { "unix" } else if cfg!(windows) { "windows" } else { "unknown" }; println!("I'm running on a {} machine!", machine_kind); }
use actix_web::{web, App, HttpServer, Responder}; fn index(info: web::Path<(u32, String)>) -> impl Responder { format!("Hello {}! id:{}", info.1, info.0) } fn main() -> std::io::Result<()> { HttpServer::new( || App::new().service( web::resource("/{id}/{name}/index.html").to(index))) ...
use std::fs::File; use std::io::prelude::*; fn read_data(filepath: &str) -> std::io::Result<String> { let mut file = File::open(filepath)?; let mut contents: String = String::new(); file.read_to_string(&mut contents)?; Ok(contents.trim().to_string()) } fn sol1() { let tmp = read_data("input1.txt")...
#![allow(dead_code)] use std::io::stdin; fn if_statement(temp:i32){ // Functional programming style let day = if temp < 20 {"cold"} else if temp > 32 { "hot" } else { "good" }; // functional programming style println!("It's a {} day", day); println!("It's a {} day", if temp < 20 { i...
use acid_list::{AcidList, LinkIndex}; use std::io; fn main() -> io::Result<()> { let mut args = std::env::args(); args.next(); // skip program name let path = args.next().ok_or(io::ErrorKind::InvalidInput)?; let file = std::fs::OpenOptions::new().read(true).write(true).open(path)?; let list = Aci...
/* * Fast discrete cosine transform algorithms (Rust) * * Copyright (c) 2019 Project Nayuki. (MIT License) * https://www.nayuki.io/page/fast-discrete-cosine-transform-algorithms * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation fil...
#[doc = "Register `ITLINE29` reader"] pub type R = crate::R<ITLINE29_SPEC>; #[doc = "Field `USART3` reader - USART3"] pub type USART3_R = crate::BitReader; #[doc = "Field `USART4` reader - USART4"] pub type USART4_R = crate::BitReader; #[doc = "Field `USART5` reader - USART5"] pub type USART5_R = crate::BitReader; impl...
/// 给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标。 /// 你可以假设每种输入只会对应一个答案。但是,你不能重复利用这个数组中同样的元素。 /// ## Examples: /// ### Example 1 /// 给定 nums = [2, 7, 11, 15], target = 9 /// 因为 nums[0] + nums[1] = 2 + 7 = 9 /// 所以返回 [0, 1] /// ```rust /// # use leetcode_SAO::problems::problem1::two_sum; /// # /// ass...
extern crate gui; use gui::*; use math::*; #[derive(Clone)] struct ImageExample { x: f32 } impl State for ImageExample { fn draw(&self, frame: &mut Frame, data: &StateData) { for i in 0..100_000 { frame.ellipse() .position(Vec2::new(i as f32 / 10_000.0 - 0.5 + self.x, i...
use directories_next::ProjectDirs; use cid::Cid; use sp_ipld::{ dag_cbor::{ cid, DagCborCodec, }, ByteCursor, Codec, Ipld, }; use std::{ fs, path::{ Path, PathBuf, }, }; use yatima_utils::store::Store; pub fn hashspace_directory() -> PathBuf { let proj_dir = ProjectDirs::from("io...
// Copyright 2020-Present (c) Raja Lehtihet & Wael El Oraiby // // 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 ...
mod lex; pub mod parse; pub use self::lex::{lex_buffer, tokenify_string}; pub use self::parse::{parse_chunk, parse_lua_source, ParseError};
//! Metro is a crate for creating and rendering graphs //! similar to `git log --graph`. //! //! # Example Output //! //! *The code for creating the following example, can be found //! after the graph.* //! //! ```text //! * Station 1 //! * Station 2 //! * Station 3 //! |\ //! | * Station 4 //! | |\ //! | * | Station 5...
fn main() { let (x,y,z)=(1,2,3); let a=(3,4,5); println!("{}",a.0); }
extern crate tinytl; pub use tinytl::syntax::*; pub use tinytl::types::*; pub use tinytl::infer::*; pub use tinytl::env::*; pub use std::collections::HashMap; fn main() { println!("{}", generalize(&HashMap::new(), &infer(&get_assumptions(), &EAbs("a", Box::new(ELet("x", Box::new(EAbs("b", Box::new(ELet("y", Box::n...
use woothee; pub struct Context { pub request: http::request::Request<Vec<u8>>, builder: std::cell::RefCell<http::response::Builder>, } impl Context { pub fn new(request: http::request::Request<Vec<u8>>) -> Self { Context { request, builder: std::cell::RefCell::new(http::res...
fn main() { // immutable by default let y = 4; println!("The value of y is {}", y); // this will throw an error at compile time // y = 5 // mutable let mut x =5; println!("The value of x is {}", x); x = 6; println!("The value of x is {}", x); shadowing(); } // an example o...
use std::io::{Result, Read, Write, ErrorKind}; //TODO inline hint? /// /// Reads a specific length from a Read trait into given Vec /// pub fn read_to_vec(reader: &mut Read, size: usize, buf: &mut Vec<u8>) -> Result<usize> { if buf.len() < size { buf.reserve(size); while buf.len() < size { buf.push(0); }...
use std::num::NonZeroU64; use crate::*; use math::Vector2; use wgpu::util::DeviceExt; use wgpu::{CommandEncoder, RenderPass, TextureView}; pub struct Shader { pub(crate) internal: std::sync::Arc<ShaderInternal>, } impl Shader { pub(crate) fn from_readers<SR>( device: &wgpu::Device, shader_reader: SR, primit...
use std::env; use std::fs::File; use std::io::prelude::*; use std::process::Command; mod rusty_lexer; mod token; mod ast; fn main() { if cfg!(not(target_os = "linux")) { panic!("this compiler currently only works on linux!"); } let args: Vec<String> = env::args().collect(); let filename = &a...
use std::ops::Deref; pub struct MyRc<T> { ptr: *mut T, refcount: *mut usize, weakcount: *mut usize, } impl<T> Drop for MyRc<T> { fn drop(&mut self) { match unsafe{*self.refcount} { 1 => { unsafe{Box::from_raw(self.ptr);} match un...
extern crate websocket; #[macro_use] extern crate serde_derive; #[macro_use] extern crate serde_json; mod gdax_client; use std::time::{SystemTime, Duration}; use std::thread; fn main() { // Start a mark time thread, spins and reports what time it is. thread::spawn(|| { loop { println!("{...
use std::collections::HashMap; #[derive(Debug)] struct ProgramNode<'a> { weight: u32, children: Vec<&'a str>, } pub fn solve_puzzle_part_1(input: &str) -> String { root_program(&create_program_tree(input)).to_string() } pub fn solve_puzzle_part_2(input: &str) -> String { let tree = create_program_tre...
mod args; mod error; pub mod httpd; pub mod mqtt; pub use args::*; pub use error::{Error, ErrorKind}; pub use mqtt::Mqtt; pub type Result<T, E = crate::Error> = std::result::Result<T, E>;
/* resources.rs -> a resource manager base Copyright (C) 2019 - scarletkrath This program 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...
// Copyright 2019, 2020 Wingchain // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to...
pub fn run() { amethyst::Logger::from_config_formatter( amethyst::LoggerConfig { stdout: amethyst::StdoutLog::Colored, level_filter: amethyst::LogLevelFilter::Info, log_file: Option::None, allow_env_override: true, log_gfx_backend_level: Option::Some( amethyst::LogLevelFilter::Warn ), log_...
use crate::{ db::HirDatabase, expressions::{ AscriptionExprData, AssignmentData, BlockExprData, CallExprData, ExpressionData, FieldExprData, IfExprData, LiteralData, MatchExprData, RecordExprData, StatementData, }, ident::{IdentifierData, ScopedIdentifierData}, items::{ Const...
use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Span, Value}; #[derive(Clone)] pub struct Debug; impl Command for Debug { fn name(&self) -> &str { "debug" } fn usage(&self) -> &str { ...
pub mod merkle; pub mod codedMerkleTree; super::primitive::{hash, block};
#![no_main] use libfuzzer_sys::fuzz_target; fuzz_target!(|data: Vec<u16>| { let mut data = data.clone(); // create a sorted vector with no duplicates data.sort(); data.dedup(); let mut r = rsdict::RsDict::new(); let mut last_value = 0; for v in &data { for _ in last_value..*v { ...
use actix_web::cookie::Cookie; use crypto::digest::Digest; use crypto::sha2::Sha256; pub fn get_hash(password: &str) -> String { let mut hasher = Sha256::new(); hasher.input_str(password); let hex = hasher.result_str(); hex } pub fn get_cookie(token: String) -> Cookie<'static> { Cookie::build("tok...
use std::ops::Add; #[derive(Debug, PartialEq)] pub struct Vector { pub dx: f64, pub dy: f64, pub dz: f64 } impl Vector { pub fn new(dx: f64, dy: f64, dz: f64) -> Vector { Vector { dx: dx, dy: dy, dz: dz } } pub fn magnitude(&self) -> f64 { (self.dx.powi(2) + self.dy.powi(2) + ...
// emulator use crate::{emulator::Emulator, host::Host, zx::tape::TapeImpl, Result}; use rustzx_z80::{RegName16, Z80Bus, FLAG_CARRY, FLAG_ZERO}; pub fn fast_load_tap<H: Host>(emulator: &mut Emulator<H>) -> Result<()> { // So, at current moment we at 0x056C in 48K Rom. // AF contains some garbage. so we need to...
//! This crate gives a specification for the EdDSA signature scheme ed25519. //! As there is no proper consensus for the verification algorithm, it has been implemented //! in multiple ways. //! - zcash_verify implements the ZIP-0215 standard (<https://zips.z.cash/zip-0215>) //! - ietf_cofactored_verify and ietf_cofact...
//! DFS - Dumb FileSystem //! Supports only a handful of operations //! //! | Super Block | 0 //! | Root INode | 1 //! | Free Map 0 | 2 //! | Free Map 1 | 3 //! | ........... | 4 //! | INode/Data | 5 //! mod fsop; mod vnop; const DFS_MAGIC: u32 = 0xDEADF5F5; const DINODE_MAGIC: u32 = 0xDEEAC0DE; #[repr(C, packed...
//#![deny(warnings)] extern crate hyper; extern crate futures; extern crate pretty_env_logger; use std::fs::{File}; use std::io::{Read}; use self::futures::future::FutureResult; use hyper::header::ContentLength; use hyper::server::{Http, Service, Request, Response}; const HTTP_ADDR: &'static str = "0.0.0.0:1980"; c...
use crate::defaults; use actix_web::HttpServer; use drogue_cloud_service_api::health::{HealthCheckError, HealthChecked}; use futures::StreamExt; use serde::Deserialize; use serde_json::{json, Value}; use std::future::Future; use std::sync::Arc; #[derive(Clone, Debug, Deserialize)] pub struct HealthServerConfig { #...
use chrono::{ serde::{ts_milliseconds, ts_milliseconds_option}, DateTime, Utc, }; use serde::{ser::Serializer, Serialize}; use serde_with::{rust::StringWithSeparator, CommaSeparator}; use sqlx::PgPool; use std::str::FromStr; use tracing::field::{debug, Empty}; use warp::Rejection; use crate::error::Error; use ...
pub struct Solution {} impl Solution { /// Converts a decimal integer to a roman numeral. /// /// # Arguments /// /// * 'num' - A base 10 integer. /// /// # Constraints /// * 1 <= num <= 3999 /// /// # Examples /// /// ``` /// # use crate::integer_to_roman::Solu...
#![allow(unused_imports, unused_labels, unused_variables, dead_code)] #[macro_use] extern crate log; extern crate rand; pub extern crate wire; pub mod boot; pub mod net; pub mod cache; pub mod config; pub mod protocol; pub mod name_server; pub mod gather; // pub mod query; pub mod stub; use tokio::net::UdpSocket;...
use std::cmp::{PartialOrd, Ordering}; /// Describes a "debug location" (source location) #[derive(PartialEq, Eq, Clone, Debug, Hash)] pub struct DebugLoc { /// The source line number pub line: u32, /// The source column number /// /// `Instruction`s and `Terminator`s have this info (and will have `...
use crate::ast::*; use crate::buffered_iterator::*; use crate::scanning::*; struct Parser<'a> { scanner: BufferedIterator<Token, Scanner<'a>>, } impl<'a> Parser<'a> { fn new(input: &str) -> Parser<'_> { let scanner = Scanner::new(input); let buf = BufferedIterator::new(scanner); Parser { scanner: buf } } ...
//! Defines an action for reading a document from the CouchDB server. use {DatabaseName, Document, Error, IntoDocumentPath, Revision, std}; use action::query_keys::*; use document::JsonDecodableDocument; use transport::{JsonResponse, JsonResponseDecoder, Request, StatusCode, Transport}; /// Reads a document from the ...
use super::*; use std::net::Ipv4Addr; use serde_json::Value; pub(crate) static POD_INFO: KindInfo = KindInfo { plural: "pods", default_namespace: Some("default"), api: V1_API, }; #[derive(Serialize, Deserialize, Debug)] pub struct Pod { pub spec: PodSpec, pub metadata: Metadata, pub status: Op...
macro_rules! serde_delegate { (visit_str $($rest:tt)*) => { fn visit_str<E: de::Error>(self, s: &str) -> Result<Self::Value, E> { self.visit_bytes(s.as_bytes()) } }; (visit_bytes $($rest:tt)*) => { fn visit_bytes<E: de::Error>(self, v: &[u8]) -> Result<Self::Value, E> { ...
#[doc = "Reader of register CM4_STATUS"] pub type R = crate::R<u32, super::CM4_STATUS>; #[doc = "Reader of field `SLEEPING`"] pub type SLEEPING_R = crate::R<bool, bool>; #[doc = "Reader of field `SLEEPDEEP`"] pub type SLEEPDEEP_R = crate::R<bool, bool>; #[doc = "Reader of field `PWR_DONE`"] pub type PWR_DONE_R = crate:...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - OPAMP1 control/status register"] pub opamp1_csr: OPAMP1_CSR, #[doc = "0x04 - OPAMP2 control/status register"] pub opamp2_csr: OPAMP2_CSR, #[doc = "0x08 - OPAMP3 control/status register"] pub opamp3_csr: OPAMP3_CSR, ...
//! The VAPIX v3 AP was introduced in firmware 5.00 in 2008. //! //! This API is documented in [a PDF] which does not appear to be presently be available from Axis. //! It remains available from third parties, including [the Wayback Machine]. //! //! The v3 API does not provide an explicit service discovery interface, ...
extern crate disrusm; use disrusm::*; use std::time::Instant; fn main() { use std::fs::File; use std::io::prelude::Read; let mut f: File = File::open("code.bin").unwrap(); let mut bytes: Vec<u8> = vec![]; f.read_to_end(&mut bytes).unwrap(); let bytes = bytes; let start = Instant::now(); ...
use qas::prelude::*; qas!("tests/c/string.c"); #[cfg(test)] #[test] fn main() { assert_eq!(unsafe { hi().to_rust() }, "Hi there"); assert_eq!(unsafe { return_same("Return me\0".to_c()).to_rust() }, "Return me"); assert_eq!(unsafe { hi().to_rust().to_c().to_rust() }, "Hi there") }
//! [LinkInfo](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-shllink/6813269d-0cc8-4be2-933f-e96e8e3412dc) related structs mod volume_id; mod common_network_relative_link; use winparsingtools::{ utils, traits::Path }; use byteorder::{LittleEndian, ReadBytesExt}; use std::fmt::{self, Display};...
mod image; pub use image::FsImageRepository;
use platform::drivers; #[main] fn main() { println!("{}", drivers::vga::Black); }
// The MIT License (MIT) // Copyright (c) 2015 Rustcc developers // 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, c...
use super::regs::Regs; use crate::r650x::alu::ALU; use crate::r650x::pipeline::Pipeline; use crate::microvm::memory::sparse::SparseAddressSpace; use crate::microvm::memory::address_space::AddressSpace; use crate::microvm::memory::MemoryError; use crate::r650x::flags::{PSRFlag, FlagRegister}; pub struct Core { pipe...
extern crate hyper; extern crate irc; extern crate config; extern crate regex; extern crate rquery; use std::io::Read; use irc::client::prelude::*; use std::path::Path; use config::reader; use hyper::Client; use regex::Regex; use std::result; fn get_title_for_url(url :&str) -> Result<String, String> { let client ...
extern crate rand; use rand::{Rng, SeedableRng, XorShiftRng}; use std::cmp; use std::collections::{BTreeMap, HashMap, VecDeque}; use std::fs::File; use std::io::{self, Read}; use std::path::Path; pub struct Corpus { seed: [u32; 4], max_context: usize, words: Vec<String>, table: HashMap<Vec<String>, BT...
#[doc = "Reader of register INTR_MASKED"] pub type R = crate::R<u32, super::INTR_MASKED>; #[doc = "Reader of field `ALARM1`"] pub type ALARM1_R = crate::R<bool, bool>; #[doc = "Reader of field `ALARM2`"] pub type ALARM2_R = crate::R<bool, bool>; #[doc = "Reader of field `CENTURY`"] pub type CENTURY_R = crate::R<bool, b...
// This file is part of dpdk. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/dpdk/master/COPYRIGHT. No part of dpdk, including this file, may be copied, modified, propagated, or distributed except accordin...
#[cfg(feature = "with-bitcountry-runtime")] mod service_bitcountry; #[cfg(feature = "with-parachain-runtime")] mod service_parachain; #[cfg(feature = "with-tewai-runtime")] mod service_tewai; #[cfg(feature = "with-bitcountry-runtime")] pub use service_bitcountry::{new_full, new_light, new_partial}; #[cfg(feature = "wi...
#![feature(array_windows)] use std::{ cmp::{max, min}, collections::{HashMap, HashSet}, }; fn main() { let input = include_str!("../data/2015-09.txt"); println!("Part 1: {}", part1(input)); println!("Part 2: {}", part2(input)); } fn part1(input: &str) -> i32 { let mut places = Places::new(inp...
use chrono::Weekday; use serenity::model::prelude::ReactionType; pub const PREV: &str = "⬅"; pub const NEXT: &str = "➡"; pub const FIRST: &str = "⏮️"; pub const LAST: &str = "⏭️"; pub const STOP: &str = "❌"; pub const HOME: &str = "🔢"; pub const DELETE: &str = "🗑️"; pub const ONE: &str = "1⃣"; pub const TWO: &str ...
use core::{ cell::UnsafeCell, marker::Unpin, ops::{Deref, DerefMut}, pin::Pin, }; use crate::Unq; use win32::{ kernel32::{AcquireSRWLockExclusive, ReleaseSRWLockExclusive}, SRWLOCK, SRWLOCK_INIT, }; pub struct LockGuard<'a, T> { mutex: &'a Mutex<T>, } struct NativeMutex { handle: Uns...
use std::fs::File; use std::io::prelude::*; struct Deck { content: Vec<usize>, } impl Deck { fn deck_score(&self) -> usize { self.content .iter() .rev() .enumerate() .map(|(idx, card)| (idx + 1) * card) .sum() } } #[derive(Copy, Clone)] ...
pub(crate) const PAGE_SIZE: u32 = 64 * 1024; pub(crate) const MAX_MEM_PAGE: u32 = 80; pub(crate) const MAX_TABLE_SIZE: u32 = 1024; pub(crate) const MAX_WASM_SIZE: usize = 512 * 1024;
#[cfg(feature = "client")] use graphics::Context; #[cfg(feature = "client")] use opengl_graphics::Gl; use battle_state::BattleContext; use module; use module::{IModule, Module, ModuleBase, ModuleRef}; use net::{InPacket, OutPacket}; use ship::{ShipRef, ShipState}; use sim::SimEventAdder; use sim_events::DamageEvent; u...
#![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)] ListOperations(#[from] list_operation...
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ use juno::gen_js; use juno::hparser; use std::io::Write; fn main() { match hparser::parse("function foo(p1) { var x = (p1 + p1...
pub mod counting3 { //making lib.rs package through cargo new package_name --lib, and making module pub mod check { //making sub-module pub fn digits() { //defining function in sub-module println!("We are in lib.rs package"); for counting in ...
use super::*; /// A plain list. /// /// # Semantics /// /// A complete list of [`Item`]s. /// /// # Syntax /// /// This is a set of consecutive items of the same indentation. It can only directly contain /// items. /// /// If the dirst item has a `COUNTER` in its `BULLET` the plain list is be an *ordered plain /// lis...
#[macro_export] macro_rules! anyhowize { ($e:expr) => { Error::msg($e.to_string()) }; }
extern crate ansi_term; extern crate termios; #[macro_use] extern crate log; extern crate fern; extern crate time; extern crate rand; #[macro_use] extern crate text_io; use std::collections::HashMap; use std::io::prelude::*; use std::fs::File; use std::os::unix::io::AsRawFd; use std::mem; use rand::Rng; mod directio...