text stringlengths 8 4.13M |
|---|
use format_strings::{ ANSI_RESET, ANSI_YELLOW, ANSI_GREEN };
use std::old_io::net::ip::SocketAddr;
use std::old_io::net::tcp::TcpAcceptor;
use std::old_io::{ TcpListener, TcpStream, Acceptor, Listener, BufferedStream };
use std::sync::mpsc::channel;
use std::sync::mpsc::{ Sender, Receiver };
use std::collections::HashM... |
#[macro_use]
pub mod macros;
use crate::entry::Entry;
use crossbeam_channel::{Receiver, Sender};
use log::error;
use serde::{Deserialize, Serialize};
use serde_json::json;
use std::error::Error;
use std::net::{SocketAddr, ToSocketAddrs, UdpSocket};
use std::sync::Arc;
#[derive(PartialEq, Serialize, Deserialize, Debu... |
#![no_std]
#![no_main]
extern crate atomic_queue;
use core::fmt::Write;
use rust_tm4c::tm4c_peripherals::get_peripherals;
use rust_tm4c::gpio;
use rust_tm4c::system_control;
use rust_tm4c::uart;
use rust_tm4c::timer;
use rust_tm4c::interrupt;
use atomic_queue::AtomicQueue;
const CPU_FREQ: u32 = 120_000_000;
const... |
//! Parameters used by the VM.
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
#[cfg(not(feature = "std"))]
use alloc::rc::Rc;
#[cfg(feature = "std")]
use std::rc::Rc;
use bigint::{Address, Gas, U256};
#[cfg(feature = "std")]
use block::Header;
#[derive(Debug, Clone)]
/// Block header.
pub struct HeaderParams {
... |
use std::time::Duration;
use bevy::{
diagnostic::{
Diagnostic, DiagnosticId, Diagnostics, FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin,
},
prelude::*,
render::camera::Camera,
};
use bevy_text_mesh::prelude::*;
use rand::prelude::*;
// NOTE! Custom (unlit) material used
// tessellation qu... |
//! Duration
use serde::{Deserialize, Serialize};
/// Duration : A pair consisting of length of time and the unit of time
/// measured. It is the atomic unit from which all duration literals are
/// composed.
#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
pub struct Duration {
/// Type of... |
use test_winrt_interfaces::*;
use windows::core::*;
use Component::Interfaces::*;
use Windows::Win32::Foundation::E_NOINTERFACE;
#[implement(Component::Interfaces::IProperty)]
struct Property(i32);
#[allow(non_snake_case)]
impl Property {
fn Property(&self) -> Result<i32> {
Ok(self.0)
}
fn SetPro... |
use std::fs::File;
use std::io::prelude::*;
use std::io;
use std::io::Write as iow;
use std::fmt::Write;
use std::collections::HashMap;
use time;
//Takes a string that contains the whole contents of
//the accounts description file and returns a vector
//of tuples containing the (acct nr , name). Vec was used
//to p... |
#![no_std]
#![feature(asm)]
#![deny(warnings, unused_must_use)]
#[macro_use]
extern crate alloc;
#[macro_use]
extern crate log;
use {
alloc::{boxed::Box, sync::Arc, vec::Vec},
core::{future::Future, pin::Pin},
xmas_elf::ElfFile,
zircon_object::{dev::*, ipc::*, object::*, task::*, util::elf_loader::*, ... |
//! Simple bedgraph struct and writing utility.
#[derive(Debug, PartialEq)]
pub struct BGBlock {
pub seqid: String,
pub start: usize,
pub end: usize,
pub score: f64,
}
impl BGBlock {
pub fn new(seqid: &str, start: usize, end: usize, score: f64) -> Self {
BGBlock {
seqid: seqid.... |
use super::*;
use std::ops::*;
impl BitOr<Mask> for Mask {
type Output = Mask;
fn bitor(self, rhs: Mask) -> Self::Output {
Mask(self.0 | rhs.0)
}
}
impl BitOrAssign<Mask> for Mask {
fn bitor_assign(&mut self, rhs: Mask) {
self.0 |= rhs.0
}
}
impl BitAnd<Mask> for Mask {
type Out... |
#[doc = "Reader of register IMR"]
pub type R = crate::R<u32, super::IMR>;
#[doc = "Writer for register IMR"]
pub type W = crate::W<u32, super::IMR>;
#[doc = "Register IMR `reset()`'s with value 0"]
impl crate::ResetValue for super::IMR {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
... |
use prost::Message;
mod item {
include!(concat!(env!("OUT_DIR"), "/sample.item.rs"));
}
fn new_item(id: &str, price: i32) -> item::Item {
let mut d = item::Item::default();
d.item_id = id.to_string();
d.price = price;
d
}
#[link(wasm_import_module = "sample")]
extern {
fn log(ptr: *con... |
extern crate enet;
use std::net::Ipv4Addr;
use enet::*;
use std::time::Duration;
fn main() {
let enet = Enet::new().expect("could not initialize ENet");
let mut host = enet
.create_host::<()>(
None,
10,
ChannelLimit::Maximum,
BandwidthLimit::Unlimited,... |
use choice::*;
use history::*;
pub type Id = &'static str;
pub trait Strategy {
fn id(&self) -> Id;
/// return the strategy's next choice, based on the given history
fn choice(&self, history: &History) -> Choice;
}
/* Rust lets us create empty (Unit) structs, which are field-less. These are instantiate... |
pub mod workspaces;
pub use workspaces::Workspaces;
pub mod title;
pub use title::Title;
use {
std::{
cell::RefCell,
collections::HashMap,
ops::DerefMut,
sync::Arc,
thread,
},
swayipc::{
self,
Connection as Sway,
EventType,
reply::{Co... |
/// Data tuple dimulai dengan tanda ( dan )
/// cara akses tuple dengan menggunakan index
/// Struct juga dapat menjadi struk tuple
fn reverse(pair: (i32, bool)) -> (bool, i32) {
let (integer, boolean) = pair;
(boolean, integer)
}
fn main() {
let x = (1, true);
let rev = reverse(x);
println!("t0 = ... |
#![allow(dead_code)]
extern crate cgmath;
extern crate embree;
extern crate support;
use cgmath::{InnerSpace, Matrix, Matrix4, SquareMatrix, Vector3, Vector4};
use embree::{
Device, Geometry, Instance, IntersectContext, QuadMesh, Ray, RayHit, Scene, TriangleMesh,
};
use std::{f32, u32};
use support::Camera;
/// ... |
use super::helpers::{remainder_ref, remainder_reuse, reverse_remainder};
use crate::integer::Integer;
use core::ops::Rem;
// Rem The remainder operator %.
// ['Integer', 'Integer', 'Integer', 'Integer::remainder_assign', 'lhs',
// ['ref_mut'], ['ref']]
impl Rem<Integer> for Integer {
type Output = Intege... |
use std::ops;
use regex::Regex;
use failure::Error;
use ::pg_interval;
use ::iso_8601;
lazy_static! {
static ref YR_RE: Regex = Regex::new(r"(\d+) year").unwrap();
static ref MO_RE: Regex = Regex::new(r"(\d+) month").unwrap();
static ref DY_RE: Regex = Regex::new(r"(\d+) day").unwrap();
static ref HR_... |
extern crate ndarray;
use ndarray::*;
use std::f32;
pub fn default() -> HoughFilter {
HoughFilter{
block_size: 32,
theta_resolution: 20,
slope_count_thresh: 0
}
}
pub struct HoughFilter {
pub block_size: usize,
pub theta_resolution: usize,
pub slope_count_thresh: u32
}
pub... |
#[doc = "Reader of register DINR18"]
pub type R = crate::R<u32, super::DINR18>;
#[doc = "Reader of field `DIN18`"]
pub type DIN18_R = crate::R<u16, u16>;
impl R {
#[doc = "Bits 0:15 - Input data received from MDIO Master during write frames"]
#[inline(always)]
pub fn din18(&self) -> DIN18_R {
DIN18_... |
//! A Postgres backed implementation of the Catalog
use crate::interface::MAX_PARQUET_FILES_SELECTED_ONCE_FOR_DELETE;
use crate::{
interface::{
self, CasFailure, Catalog, ColumnRepo, ColumnTypeMismatchSnafu, Error, NamespaceRepo,
ParquetFileRepo, PartitionRepo, RepoCollection, Result, SoftDeletedRo... |
//
// Error
//! Displays a window with an error message.
//
use terminal::Terminal;
/// The width of the error window in cells.
const WIDTH: u32 = 51;
/// The height of the error window in cells.
const HEIGHT: u32 = 19;
/// The error window.
pub struct ErrorWindow {
pub term: Terminal,
}
impl ErrorWindow {
... |
/*
Gordon Adam
1107425
Struct to represent a Resource Record
*/
use std::default;
use std::io::BufReader;
use std::io::net::ip::{Ipv4Addr, SocketAddr};
use data;
#[deriving(Default,Clone)]
pub struct Resource {
pub rname: data::Data, // This is the name the resource record pertains to
pub rtype: u16, // This... |
pub use VkSamplerAddressMode::*;
#[repr(u32)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum VkSamplerAddressMode {
VK_SAMPLER_ADDRESS_MODE_REPEAT = 0,
VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT = 1,
VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE = 2,
VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = 3,
V... |
use std::cmp::Ordering;
use types::Weight;
#[derive(Clone)]
pub struct Suggestion {
value: String,
weight: Weight
}
impl PartialEq for Suggestion {
fn eq(&self, other: &Self) -> bool {
self.weight == other.weight
}
}
impl Eq for Suggestion {}
impl PartialOrd for Suggestion {
fn partial_... |
use rand::prelude::*;
use crate::bvh::*;
use crate::material::*;
use crate::ray::Ray;
use crate::texture::Texture;
use crate::vec3::*;
#[derive(Default)]
pub struct HitRecord<'a> {
pub t: f64,
pub u: f64,
pub v: f64,
pub p: Vec3,
pub normal: Vec3,
pub material: Option<&'a Material>,
}
pub trait Hitable: ... |
/*!
This is merged into a default manifest in order to form the full package manifest:
```cargo
[dependencies]
boolinator = "=0.1.0"
```
*/
extern crate boolinator;
use boolinator::Boolinator;
fn main() {
println!("--output--");
println!("{:?}", true.as_some(1));
}
|
use crate::prelude::*;
#[derive(Debug)]
pub enum Side {
Left,
Right,
Bottom,
Top,
}
pub struct Cell {
pub rect: Rect,
pub column_index: usize,
pub row_index: usize,
}
impl Cell {
pub fn contains(&self, point: &Point2) -> bool {
self.rect.left() <= point.x
&& point.... |
/*
* Copyright (C) 2020 Zixiao Han
*/
static OVERHEAD_TIME: u128 = 50;
pub struct TimeCapacity {
pub main_time_millis: u128,
pub extra_time_millis: u128,
}
pub fn calculate_time_capacity(total_time_millis: u128, moves_to_go: u128, increment: u128) -> TimeCapacity {
let main_time_millis = total_time_mil... |
use actix::prelude::*;
use crate::executor::Executor;
use crate::blender::Runner;
use crate::messages::{
WorkerWsConnect,
GetStatus,
StartRender,
JobStatusUpdate,
StatusUpdate,
JobStatus,
Status
};
pub struct WorkerState {
pub started: bool,
job_status: Option<JobStatus>,
liste... |
#![allow(unused_imports)]
mod logic;
mod arithmetic;
mod sequential;
mod architecture;
use logic::*;
use logic::bit::{O, I};
use architecture::*;
use arithmetic::*;
use sequential::*;
use sequential::ClockState::{Tick, Tock};
fn main() {
let mut computer = Computer::new();
computer.run();
computer.run();... |
use super::*;
/// class 文件版本:先minor,后major。顺序不可修改
#[derive(Debug)]
pub struct Version {
pub minor: U2,
pub major: U2,
}
|
//! Internal proof format for the Varisat SAT solver.
use varisat_formula::{Lit, Var};
pub mod binary_format;
mod vli_enc;
// Integer type used to store a hash of a clause.
pub type ClauseHash = u64;
/// Hash a single literal.
///
/// Multiple literals can be combined with xor, as done in [`clause_hash`].
pub fn li... |
#![feature(async_await, await_macro, futures_api)]
use romio::tcp::{TcpListener, TcpStream};
use futures::prelude::*;
async fn say_hello(mut stream: TcpStream) {
await!(stream.write_all(b"Shall I hear more, or shall I speak at this?"));
}
async fn listen() -> Result<(), Box<dyn std::error::Error + 'static>> {
... |
use chrono::{DateTime, TimeZone, Utc};
use csv::Reader;
use reqwest::{get, Url};
use serde::Deserialize;
use serde::de::{self, Deserializer};
use std::error::Error;
static APIBASEURL: &str = "https://www.alphavantage.co/query";
static YMD_HMS: &str = "%Y-%m-%d %H:%M:%S";
// TODO: Move this into a time utils module if... |
mod warp;
mod random;
// Maybe I shouldn't name it warp...
pub use crate::utils::warp::*;
pub use random::*;
|
const STROAGE_PATH: &'static str = r#"C:\Program Files (x86)\Warcraft III\Data"#;
const TEST_FILE: &'static str = r#"war3.w3mod:scripts\blizzard.j"#;
#[test]
fn test_all() {
let storage = casclib::open(STROAGE_PATH).unwrap();
let count = storage.file_count();
assert!(count > 0);
let mut walked = 0;
... |
// Copyright 2012-2013 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-MI... |
//! Utilities used for testing and benchmarking.
pub mod ffo;
pub mod perft;
|
// 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::{format_err, Error};
use std::ops::Deref;
use std::time::{Duration, SystemTime};
use token_cache::{CacheKey, CacheToken, KeyFor};
/// Represe... |
//! Local storage.
//!
//! Currently this consists of a Sqlite backend implementation.
// This is intended for internal use only -- do not make public.
mod prelude;
mod connection;
pub mod fake;
mod params;
mod schema;
pub mod test_utils;
use std::num::NonZeroU32;
use std::path::{Path, PathBuf};
use std::sync::Arc;
... |
#![deny(missing_docs)]
#![cfg_attr(docsrs, feature(doc_cfg))]
//! Coi provides an easy to use dependency injection framework.
//! Currently, this crate provides the following:
//! - **[`coi::Inject` (trait)]** - a marker trait that indicates a trait or struct is injectable.
//! - **[`coi::Provide` (trait)]** - a trait ... |
//! A simple object pool.
//!
//! `ObjPool<T>` is basically just a `Vec<Option<T>>`, which allows you to:
//!
//! * Insert an object (reuse an existing `None` element, or append to the end) and get an `ObjId`
//! in return.
//! * Remove object with a specified `ObjId`.
//! * Access object with a specified `ObjId`.
//... |
use arduino_uno::prelude::*;
use arduino_uno::adc::Adc;
use arduino_uno::hal::port::{
mode::Analog,
portc::PC5,
};
pub type RngType = usize;
/// Implementation of a sufficiently-random Pseudo Random Number Generator
/// that utilizes an ADC.
pub struct XOrShiftPrng {
/// The current random number.
... |
//! Rate Based Filtering
//!
//! The BurstFilter provides a mechanism to control the rate at which log events are processed by
//! silently discarding events after the maximum limit has been reached.
//!
//! # Example
//!
//! ```toml
//! [filter.burst]
//! max_burst = 10.0
//! # Optional (Defaults shown)
//! level = "W... |
use error::*;
use il;
fn sign_extend(constant: &il::Constant) -> i64 {
let value: u64 = constant.value();
let mut mask: u64 = 0xffffffffffffffff;
mask <<= constant.bits();
if constant.value() & (1 << (constant.bits() - 1)) != 0 {
(value | mask) as i64
}
else {
value as i64
}... |
use std::fmt;
use std::str::Chars;
#[derive(Debug, Eq, PartialEq)]
pub enum TokenKind {
TokenEOF,
TokenComment,
TokenWhitespace,
TokenAssign,
TokenAdd,
TokenSub,
TokenNum,
TokenLabel,
TokenKeyword,
TokenLParen,
TokenRParen,
TokenJDivider,
TokenAddress,
TokenLiteral,
}
#[derive(Debug, Eq, P... |
//! linux_raw syscalls supporting `rustix::runtime`.
//!
//! # Safety
//!
//! See the `rustix::backend` module documentation for details.
#![allow(unsafe_code)]
#![allow(clippy::undocumented_unsafe_blocks)]
use crate::backend::c;
#[cfg(target_arch = "x86")]
use crate::backend::conv::by_mut;
use crate::backend::conv::{... |
use frame_system as system;
use frame_support::assert_ok;
use move_core_types::identifier::Identifier;
use move_core_types::language_storage::ModuleId;
use move_core_types::language_storage::StructTag;
use move_vm::data::*;
use move_vm_runtime::data_cache::RemoteCache;
use serde::Deserialize;
use sp_mvm::storage::MoveV... |
// 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 ... |
use std::collections::HashSet;
use serde::{Deserialize, Serialize};
use crate::data::CrateData;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Config {
pub categories: Vec<Category>,
/// The whitelist of Category crates
pub crates: Vec<Crate>,
}
#[derive(Debug, Clone, Serialize, Deserialize)... |
pub mod typing;
|
#[macro_use]
extern crate bench_utils;
#[cfg(any(
feature = "commitment",
feature = "merkle_tree",
feature = "prf",
feature = "signature",
feature = "vrf"
))]
#[macro_use]
extern crate derivative;
pub mod crh;
pub use self::crh::*;
#[cfg(feature = "commitment")]
pub mod commitment;
#[cfg(feature ... |
//!
//!
//! Create a associated type for traits and trait implementations.
//!
use serde::{Deserialize, Serialize};
use tera::{Context, Tera};
use crate::traits::SrcCode;
use crate::{internal, Attribute, SrcCodeVec};
/// Represent the declaration of a associated type in a trait
#[derive(Serialize, Deserialize, Defau... |
use crate::error::Result;
use crate::proto::{Proto, Request};
use serde::{Deserialize, Serialize};
use serde_json::json;
use std::rc::Rc;
use std::time::Duration;
pub trait Wlan {
fn get_scan_info(
&mut self,
refresh: bool,
timeout: Option<Duration>,
) -> Result<Vec<AccessPoint>>;
}
p... |
use rustwlc::{Point, ResizeEdge};
use uuid::Uuid;
use petgraph::graph::NodeIndex;
use super::super::LayoutTree;
use super::super::commands::CommandResult;
use super::super::core::{Direction, ShiftDirection, TreeError};
use super::super::core::container::{Container, ContainerType, ContainerErr,
... |
#[cfg(feature = "codegen")]
mod tests {
#[test]
fn ui() {
let t = trybuild::TestCases::new();
t.compile_fail("tests/failures/*.rs");
}
}
|
use core::cell::UnsafeCell;
use core::intrinsics;
use libc::{self, c_int};
use super::Duration;
/// Returns the platform-specific value of errno
pub fn errno() -> i32 {
#[cfg(any(target_os = "macos",
target_os = "ios",
target_os = "freebsd"))]
unsafe fn errno_location() -> *const c_... |
use whoami;
mod repl;
fn main() {
let username = whoami::username();
println!(
"Hello {}! This is the Monkey programming language!",
username
);
println!("Feel free to type in commands");
repl::start();
}
|
use std::old_io;
use nix::errno::{SysError, EAGAIN, EADDRINUSE};
use self::MioErrorKind::{
Eof,
BufUnderflow,
BufOverflow,
WouldBlock,
AddrInUse,
EventLoopTerminated,
OtherError
};
pub type MioResult<T> = Result<T, MioError>;
#[derive(Copy, Show, PartialEq, Clone)]
pub struct MioError {
... |
//! Completion Queue
use core::sync::atomic;
use super::sys;
use super::util::{unsync_load, Mmap};
pub struct CompletionQueue {
pub(crate) head: *const atomic::AtomicU32,
pub(crate) tail: *const atomic::AtomicU32,
pub(crate) ring_mask: *const u32,
pub(crate) ring_entries: *const u32,
overflow: *... |
extern crate libc;
pub mod jalali_bindings;
mod data_structs;
mod wrappers;
#[cfg(test)]
mod test;
pub use data_structs::*;
pub use wrappers::*;
|
use std::{env, io};
use list_dirs::printer;
fn main() -> io::Result<()> {
#[cfg(windows)]
let _enabled = ansi_term::enable_ansi_support();
let mut args: Vec<String> = env::args().collect();
match args.len() {
1 => args.push(String::from(".")),
2 => (),
_ => {
return E... |
use std::convert::TryFrom;
use byteorder::{ByteOrder, LittleEndian};
use chrono::{DateTime, Datelike, NaiveDate, NaiveDateTime, NaiveTime, Timelike, Utc};
use crate::decode::Decode;
use crate::encode::Encode;
use crate::io::{Buf, BufMut};
use crate::mysql::protocol::TypeId;
use crate::mysql::type_info::MySqlTypeInfo;... |
// ...
use proc_macro::{TokenStream, TokenTree, Delimiter};
use crate::{Error, Result, Parse};
use crate::name::Type;
use crate::utils;
// Params represents function's parameters
#[derive(Debug)]
pub struct Params {
pub items: Vec<ParamItem>,
}
impl ToString for Params {
fn to_string(&self) -> String {
... |
use bytes::{BufMut, Bytes, BytesMut};
use model::command::SmtpCommand;
use model::controll::*;
use tokio::io;
use tokio_codec::{Decoder, Encoder};
pub struct LineCodec {
next_index: usize,
}
impl LineCodec {
pub fn new() -> Self {
LineCodec { next_index: 0 }
}
}
impl Decoder for LineCodec {
t... |
use std::io;
use anyhow::Result;
use nexers::nexus::Event;
#[test]
fn load() -> Result<()> {
let mut events = Vec::with_capacity(2);
nexers::nexus::read(
io::BufReader::new(io::Cursor::new(&include_bytes!("tiny-file")[..])),
|ev| {
events.push(ev);
Ok(())
},
... |
use crate::components::login::login_form::LoginForm;
use crate::components::shared::page::Page;
use yew::prelude::*;
pub struct LoginPage;
impl Component for LoginPage {
type Message = ();
type Properties = ();
fn create(_props: Self::Properties, _link: ComponentLink<Self>) -> Self {
Self {}
... |
use crate::{
parser::*,
tokenizer::{Interpol as TokenInterpol, Token, TokenKind, Trivia}
};
use std::fmt;
impl fmt::Display for Trivia {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
Trivia::Newlines(amount) => for _ in 0..amount {
write!(f, "\n")... |
#[cfg(feature = "build-native-harfbuzz")]
extern crate cmake;
#[cfg(feature = "build-native-harfbuzz")]
extern crate pkg_config;
#[cfg(feature = "build-native-harfbuzz")]
fn main() {
use std::env;
use std::process::Command;
use std::path::PathBuf;
println!("cargo:rerun-if-env-changed=HARFBUZZ_SYS_NO_P... |
pub(crate) mod poll_fd;
#[cfg(not(windows))]
pub(crate) mod types;
#[cfg_attr(windows, path = "windows_syscalls.rs")]
pub(crate) mod syscalls;
#[cfg(linux_kernel)]
pub mod epoll;
|
use std::{fmt::Debug, rc::Rc};
use super::DynType;
#[derive(Clone)]
pub struct Value {
pub content: Rc<DynType>,
pub position: Option<(u32, u16)>,
}
impl Value {
pub fn new(content: DynType, position: Option<(u32, u16)>) -> Self {
Self {
content: Rc::new(content),
position... |
use crate::server::LSPServer;
use crate::sources::LSPSupport;
use log::{debug, trace};
use ropey::{Rope, RopeSlice};
use std::time::Instant;
use tower_lsp::lsp_types::*;
pub mod keyword;
impl LSPServer {
pub fn completion(&self, params: CompletionParams) -> Option<CompletionResponse> {
debug!("completion ... |
// 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::switchboard::base::*,
crate::switchboard::hanging_get_handler::{HangingGetHandler, Sender},
crate::switchboard::switchboard_impl::S... |
use procon_reader::ProconReader;
fn main() {
let stdin = std::io::stdin();
let mut rd = ProconReader::new(stdin.lock());
let n: usize = rd.get();
let m: usize = rd.get();
let k: usize = rd.get();
let mut tail = Vec::new();
let mut inv = 0;
let mut a = Vec::new();
for x in (0..n).r... |
//! Focused state.
crate::state_group! {
[SelectionStateGroup: 0x8000_0000] = {
Unselected = 0,
Selected = 0x8000_0000,
}
}
|
//pub mod bounding;
pub mod collision;
pub mod geometry;
pub use geometry::{
Triangle, Tetrahedron, Pentachoron,
Measure, Degenerable, Decomposable
};
pub use collision::{
Collidable, CollisionDescribable
}; |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[cfg(feature = "Devices_Sensors_Custom")]
pub mod Custom;
#[link(name = "windows")]
extern "system" {}
pub type Accelerometer = *mut ::core::ffi::c_void;
pub type AccelerometerDataThreshold = *mut ::core:... |
use std::fs;
#[test]
fn validate_1_1() {
assert_eq!(algorithm("src/day_1/input_test.txt", false).0, 514579);
}
fn algorithm(file_location: &str, print_results: bool) -> (i32, usize) {
let contents = fs::read_to_string(file_location).unwrap();
let values: Vec<&str> = contents.lines().collect();
let mut... |
use aoc2018::*;
#[derive(Default, Debug)]
struct Node {
metadata: Vec<u32>,
children: Vec<Node>,
}
impl Node {
fn part1sum(&self) -> u32 {
self.metadata.iter().cloned().sum::<u32>()
+ self.children.iter().map(|c| c.part1sum()).sum::<u32>()
}
fn part2sum(&self) -> u32 {
... |
#[path = "process_flag_2/with_atom_flag.rs"]
mod with_atom_flag;
// `without_atom_flag_errors_badarg` in unit tests
|
mod error;
use gstreamer::glib::SendValue;
use gstreamer::prelude::*;
use gstreamer::*;
use gstreamer_pbutils::prelude::*;
use gstreamer_pbutils::{
pb_utils_get_codec_description, Discoverer, DiscovererContainerInfo, DiscovererInfo,
DiscovererResult, DiscovererStreamInfo,
};
use std::env::args;
use std::iter::... |
use migration::Migrator;
use sea_schema::migration::*;
#[async_std::main]
async fn main() {
cli::run_cli(Migrator).await;
}
|
use crate::{
demos::{Chunk, Demo},
types::HitableList,
Camera,
};
pub struct SimpleRectangle;
impl Demo for SimpleRectangle {
fn name(&self) -> &'static str {
"simple_rectangle"
}
fn render_chunk(
&self,
chunk: &mut Chunk,
_camera: Option<&Camera>,
_wor... |
use std::collections::HashMap;
use petgraph::{Graph, Directed};
use petgraph::graph::NodeIndex;
use petgraph::visit::GetAdjacencyMatrix;
use fixedbitset::FixedBitSet;
fn bary_center<N, E>(
graph: &Graph<N, E, Directed>,
matrix: &FixedBitSet,
h1: &Vec<NodeIndex>,
h2: &Vec<NodeIndex>,
) -> HashMap<NodeIn... |
use clap::{crate_description, crate_name, crate_version, App, Arg};
use log::*;
use morgan::clusterMessage::{Node, FULLNODE_PORT_RANGE};
use morgan::connectionInfo::ContactInfo;
use morgan::localVoteSignerService::LocalVoteSignerService;
use morgan::service::Service;
use morgan::socketaddr;
use morgan::verifier::{Valid... |
pub mod pos ;
mod map ;
pub mod error;
pub use map::* ;
|
use std::{
any::Any,
sync::{
atomic::{AtomicBool, Ordering},
Arc,
},
};
use async_trait::async_trait;
use futures::{
future::{BoxFuture, Shared},
FutureExt, TryFutureExt,
};
use tokio::sync::mpsc;
use tokio::task::JoinError;
use observability_deps::tracing::{error, info, warn};
use... |
use near_sdk::json_types::ValidAccountId;
use near_sdk::{
borsh::{self, BorshDeserialize, BorshSerialize},
env,
};
use std::convert::TryInto;
#[derive(
BorshDeserialize,
BorshSerialize,
Clone,
Copy,
PartialEq,
Eq,
Hash,
Debug,
Ord,
PartialOrd,
Default,
)]
pub struct ... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[link(name = "windows")]
extern "system" {
#[cfg(feature = "Win32_Graphics_Gdi")]
pub fn AddStroke(hrc: HRECOCONTEXT, ppacketdesc: *const PACKET_DESCRIPTION, cbpacket: u32, ppacket: *const u8, pxf... |
use std::collections::BTreeMap;
pub fn transform(h: &BTreeMap<i32, Vec<char>>) -> BTreeMap<char, i32> {
let mut map: BTreeMap<char, i32> = BTreeMap::new();
for (score, letters) in h.iter() {
for letter in letters {
map.insert(letter.to_ascii_lowercase(), *score);
}
}
return ... |
#![allow(non_snake_case)]
use crate::{builtins::PyModule, PyRef, VirtualMachine};
pub(crate) fn make_module(vm: &VirtualMachine) -> PyRef<PyModule> {
let module = winreg::make_module(vm);
macro_rules! add_constants {
($($name:ident),*$(,)?) => {
extend_module!(vm, &module, {
... |
/* Copyright (C) 2016 Yutaka Kamei */
extern crate scim;
extern crate rustc_serialize;
use rustc_serialize::json;
use scim::schema::resource::*;
const POST_DATA : &'static str = "{
\"schemas\":[\"urn:ietf:params:scim:schemas:core:2.0:User\"],
\"userName\":\"bjensen\",
\"externalId\":\"bjensen\",
\"name\":{
... |
import sys;
import ptr;
import unsafe;
export _chan;
export _port;
export mk_port;
native "rust" mod rustrt {
type void;
type rust_chan;
type rust_port;
fn new_chan(po : *rust_port) -> *rust_chan;
fn del_chan(ch : *rust_chan);
fn drop_chan(ch : *rust_chan);
fn chan_send(ch: *rust_chan, v... |
use proc_macro2::Group;
use quote::ToTokens;
use syn::{
parse::Nothing,
visit_mut::{self, VisitMut},
*,
};
#[cfg(feature = "try_trait")]
use crate::utils::expr_call;
use crate::utils::{expr_unimplemented, replace_expr, Attrs, AttrsMut};
use super::{Context, VisitMode, DEFAULT_MARKER, NAME, NEVER};
// ===... |
extern crate rustc_serialize;
extern crate docopt;
extern crate walkdir;
extern crate pulldown_cmark;
extern crate mustache;
extern crate yaml_rust;
extern crate virgil;
const USAGE: &'static str = "
Virgil - a rusty static site generator.
Usage:
virgil init [-v] [-p <path>]
virgil post [-v] [-p <path>] <file>
... |
use crate::cpp_data::{CppBaseSpecifier, CppItem, CppPath, CppPathItem};
use crate::cpp_ffi_data::CppCast;
use crate::cpp_function::{CppFunction, CppFunctionArgument};
use crate::cpp_type::{CppPointerLikeTypeKind, CppType};
use crate::database::ItemWithSource;
use crate::processor::ProcessorData;
use ritual_common::erro... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Major git tag version. For example, this firmware was built from git tag ``v2.0.3``, so this value is ``2``."]
pub major: MAJOR,
_reserved1: [u8; 3usize],
#[doc = "0x04 - Minor git tag version. For example, this firmware wa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.