text stringlengths 3.09k 13.9k |
|---|
//! This module contains data types for interacting with `Scope`s.
use std::cell::RefCell;
use std::fmt;
use std::rc::Rc;
/// Universal closure wrapper.
/// <aside class="warning">
/// Use closure adapters carefully, because if you call one from the `update` loop
/// of a `Component` (even from JS) it will delay a me... |
use std::fmt::{Display, Result, Formatter};
use crate::difficulty::DifficultyRating::{Deadly, Easy, Hard, Medium};
#[derive(Debug, PartialEq)]
pub enum DifficultyRating {
Easy,
Medium,
Hard,
Deadly,
}
impl Display for DifficultyRating {
fn fmt(&self, f: &mut Formatter) -> Result {
f.writ... |
use crate::*;
use anyhow::Result;
use redis::{
streams::{StreamReadOptions, StreamReadReply},
Commands,
};
use std::collections::HashMap;
use std::str::FromStr;
pub trait SortedStreams {
/// "XREADGROUP >" across streams, handle all the messages in time order,
/// and acknowledge them all. The XACK ca... |
//! The arc primitive
use crate::{
geometry::{Angle, Dimensions, Point, Size},
primitives::{Circle, PointsIter, Primitive, Rectangle},
transform::Transform,
};
mod points;
mod styled;
pub use points::Points;
pub use styled::StyledPixelsIterator;
/// Arc primitive
///
/// # Examples
///
/// ## Create som... |
// Copyright 2021 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 {
anyhow::{anyhow, Context, Result},
diagnostics_hierarchy::Property,
errors::{ffx_error, FfxError},
ffx_core::ffx_plugin,
ffx_flut... |
//! Communicate with the Polar virtual machine: load rules, make queries, etc/
use polar_core::terms::{Call, Symbol, Term, Value};
use std::fs::File;
use std::io::Read;
use std::sync::Arc;
use crate::host::Host;
use crate::query::Query;
use crate::OsoError;
use crate::{ToPolar, ToPolarList};
/// Oso is the main str... |
//! # crateinfo
//!
//! Loads crate information.
//!
#[cfg(test)]
#[path = "./crateinfo_test.rs"]
mod crateinfo_test;
use crate::command;
use crate::types::{CargoMetadata, CrateDependency, CrateInfo};
use fsio;
use glob::glob;
use serde_json;
use std::env;
use std::path::{Path, PathBuf};
use std::process::Command;
us... |
use std::collections::HashMap;
use std::sync::Arc;
use std::{fs, path::PathBuf};
use log::{error, info};
use tokio::net::TcpListener;
use tokio::sync::Mutex;
use tokio::task;
use crate::configure::DoreaFileConfig;
use crate::database::DataBaseManager;
use crate::event::EventManager;
use crate::handle;
use once_cell:... |
use futures::StreamExt;
use async_trait::async_trait;
use serde::{Deserialize, Serialize};
use shiplift::{tty::TtyChunk, ContainerOptions, PullOptions};
use tempfile::{Builder, TempDir};
use uuid::Uuid;
use crate::models::TaskError;
use crate::{
traits::{BoxedStream, Executable, FromJson, GetSerdeFromProps},
G... |
//! Module `time` contains everything related to the time measurement of unit tests
//! execution.
//! Two main purposes of this module:
//! - Check whether test is timed out.
//! - Provide helpers for `report-time` and `measure-time` options.
use std::time::{Duration, Instant};
use std::str::FromStr;
use std::fmt;
us... |
use components::{
backgrounds::{callbacks::Callbacks as BackgroundsCallbacks, state::Backgrounds},
stickers::{
callbacks::Callbacks as StickersCallbacks,
state::{Sticker, Stickers},
},
text_editor::{callbacks::Callbacks as TextEditorCallbacks, state::State as TextEditorState},
};
use com... |
// Copyright 2016 Mozilla
//
// 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... |
// 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::display_metrics::{DisplayMetrics, ViewingDistance},
crate::graphics_utils::{ImageResource, ScreenCoordinates},
anyhow::Error,
... |
use std::fs::{remove_file, create_dir_all};
use std::path::{Path, PathBuf};
use rocket::form::Form;
use rocket::fs::{NamedFile, TempFile};
use rocket::serde::Serialize;
use rocket_dyn_templates::Template;
/// Struct to save file attributes to render in the index page
#[derive(Serialize)]
#[serde(crate = "rocket::serd... |
use crate::{
metadata::{self, PackageMetadata},
start::requests::{InvokeRequest, ServerError},
};
use axum::{body::Body, response::Response};
use std::{
collections::{hash_map::Entry, HashMap, VecDeque},
path::PathBuf,
sync::Arc,
};
use tokio::{
process::Command,
sync::{
mpsc::{self,... |
use arbitrary::{Arbitrary, Error, Unstructured};
use rand::RngCore;
use std::sync::atomic::{AtomicIsize, AtomicUsize, Ordering::SeqCst};
use std::sync::Arc;
use wasm_smith::SwarmConfig;
use wasmtime::*;
struct State {
engine: Engine,
print: bool,
remaining: AtomicIsize,
total: AtomicUsize,
instanti... |
use super::{
Application, UEFIError,
api::{
EfiPhyiscalAddress,
boot_services::memory,
},
};
pub trait Memory {
fn allocate(&mut self, size: usize) -> Option<*mut core::ffi::c_void>;
/// Attempt to allocate `count` continuous 4KiB pages.
fn allocate_pages_at(&mut self, addr: u64... |
// Durable storage stuff.
use crate::syntax::{SourceSpan,Module,Value};
use crate::parse::ModuleParser;
use lalrpop_util::ParseError;
use sqlite;
use home;
use std::fmt::Debug;
use std::collections::BTreeMap;
use bincode;
#[derive(Debug)]
pub enum StorageError {
UnderlyingError(sqlite::Error),
UnknownSchema... |
use crate::graph::{ImageEdge, ImageGraph};
use crate::segmentation::{Distance, Magic};
use opencv::core::{Scalar, Vec3b, CV_32SC1};
use opencv::prelude::*;
/// Implementation of graph based image segmentation as described in the
/// paper by Felzenswalb and Huttenlocher.
#[derive(Debug)]
pub struct Segmentation<D, M>
... |
use std::{collections::HashSet, str::FromStr};
use crate::metadata::{CoverImage, Metadata};
use crate::recon::ReconError;
use isbn2::{Isbn, Isbn10, Isbn13};
use log::debug;
use scraper::{Html, Selector};
#[derive(Debug)]
/// A wrapper around [`Metadata`] for deserialization
pub struct Goodreads(Metadata);
impl Goodr... |
// advent12.rs
// assembly language
#[macro_use]
extern crate lazy_static;
extern crate regex;
use std::io;
use std::io::BufRead;
use regex::Regex;
fn main() {
let stdin = io::stdin();
let instructions: Vec<_> = stdin.lock()
.lines()
.map(|l| l.expect("Failed to read line"))
.map(|l| ... |
/// A written remark expressing an opinion or reaction.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Comment {
/// Identifier of the comment
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
/// Status of the comment which could be...
/// - Published
/// - Deleted
... |
//! Execute Docker commands as spawned processes. This module provides an abstraction, [Dockerfile], for building a
//! Wasm benchmark in a single step.
//!
//! Use the `DOCKER` environment variable to change the binary to use for this; the default is
//! `"docker"`.
use crate::wasm::WasmBenchmark;
use log::{debug, err... |
use crate::img::Color;
use crate::tile::{Block, Tile};
use std::convert::{TryFrom, TryInto};
use std::io::{self, Write};
#[cfg(test)]
mod tests;
pub struct TileCollection {
tiles: Vec<Vec<IndexedTile>>,
base_tile_ids: Vec<u16>, // Base tile ID for each block
attrs: Vec<u8>, // Attribute for each ... |
use crate::commands::WholeStreamCommand;
use crate::data::{Primitive, TaggedDictBuilder, Value};
use crate::errors::ExpectedRange;
use crate::prelude::*;
use bson::{decode_document, spec::BinarySubtype, Bson};
use std::str::FromStr;
pub struct FromBSON;
impl WholeStreamCommand for FromBSON {
fn name(&self) -> &st... |
const MAX_USER_TRAP_NUM: usize = 128;
use crate::config::CPU_NUM;
use crate::plic::Plic;
use crate::sbi::send_ipi;
use crate::task::hart_id;
use crate::task::TaskStatus::Running;
use crate::{mm::PhysPageNum, plic::get_context};
use alloc::{collections::BTreeMap, vec::Vec};
use core::arch::asm;
use heapless::spsc::Queu... |
//! TRNG driver, nRF5X-family
//!
//! The TRNG generates 1 byte randomness at the time value in the interval
//! 0 <= r <= 255.
//!
//! Because that the he capsule requires 4 bytes of randomness at the time.
//! 4 bytes of randomness must be generated before returning back to capsule.
//!
//! Therefore this module wil... |
// 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 http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![allow(dead_code,... |
use anyhow::Result;
use bcs_ext::BCSCodec;
use clap::Clap;
use jsonrpc_core_client::{RpcChannel, RpcError};
use serde::Deserialize;
use starcoin_crypto::{HashValue, ValidCryptoMaterialStringExt};
use starcoin_rpc_api::types::{TransactionInfoView, TransactionStatusView};
use starcoin_rpc_api::{
chain::ChainClient, n... |
use crate::{FromInner, HandleTrait, Inner, IntoInner};
use std::convert::TryFrom;
use uv::{uv_signal_init, uv_signal_start, uv_signal_start_oneshot, uv_signal_stop, uv_signal_t};
callbacks! {
pub SignalCB(handle: SignalHandle, signum: i32);
}
/// Additional data stored on the handle
#[derive(Default)]
pub(crate) ... |
use core::ptr;
use core::result::Result;
use core::time::Duration;
extern crate alloc;
use alloc::boxed::Box;
use embedded_svc::errors::Errors;
use embedded_svc::sys_time::SystemTime;
use embedded_svc::timer::{self, OnceTimer, PeriodicTimer, Timer, TimerService};
use esp_idf_sys::*;
#[cfg(feature = "experimental")]... |
use input::EventHandler;
use todo_file::TodoFile;
use view::{RenderContext, ViewData};
use super::State;
use crate::{
events,
events::{AppKeyBindings, Event, MetaEvent},
process::Results,
};
pub(crate) struct ModuleHandler<ModuleProvider: crate::module::ModuleProvider> {
event_handler: EventHandler<AppKeyBindings... |
use crate::{
physics::Joint,
scene::commands::physics::{
SetFixedJointAnchor1RotationCommand, SetFixedJointAnchor1TranslationCommand,
SetFixedJointAnchor2RotationCommand, SetFixedJointAnchor2TranslationCommand,
},
send_sync_message,
sidebar::{make_section, make_text_mark, make_vec3_i... |
use std::path::{Path, PathBuf};
use std::sync::{Arc, mpsc, Mutex, RwLock};
use std::thread;
use std::collections::HashMap;
use crate::common::json_call_stats::CallJson;
use crate::common::latex_utils::LatexBare;
#[derive(PartialEq, Eq, Clone)]
pub enum JobStatus {
Ready,
Running,
Completed,
}
#[derive(Clone)]
pub... |
use core::convert::TryInto;
use armv4t_emu::{reg, Memory};
use gdbstub::arch;
use gdbstub::arch::arm::reg::id::ArmCoreRegId;
use gdbstub::target;
use gdbstub::target::ext::base::singlethread::{ResumeAction, SingleThreadOps, StopReason};
use gdbstub::target::ext::breakpoints::WatchKind;
use gdbstub::target::{Target, Ta... |
// Rust language amplification derive library providing multiple generic trait
// implementations, type wrappers, derive macros and other language enhancements
//
// Written in 2019-2021 by
// Dr. <NAME> <<EMAIL>>
//
// To the extent possible under law, the author(s) have dedicated all
// copyright and related and ... |
use heck::{KebabCase};
use quote::{ToTokens, Tokens, Ident};
use ast::*;
pub struct Routes {
routes: Vec<Route>,
assets: Tokens,
}
impl Routes {
pub fn new(assets: Tokens, resources: &[RouteItem]) -> Routes {
Routes {
routes: Route::build(resources),
assets,
}
... |
use std::env;
use std::fs::File;
use std::io::prelude::*;
fn get_param(mode: i64, pos: usize, mem: &Vec<i64>) -> i64 {
return match mode {
0 => mem[mem[pos] as usize],
1 => mem[pos],
_ => mem[pos]
};
}
fn run_program(program: &Vec<i64>, input1: i64, input2: i64) -> i64 {
let mut pos: usize = 0;
let mut stop... |
//! Extension traits for Mumble's varint format.
use byteorder::ReadBytesExt;
use byteorder::WriteBytesExt;
use bytes::buf::ext::BufMutExt as _;
use bytes::BufMut;
use std::io;
/// Extension trait for reading varint values.
pub trait ReadExt: io::Read {
/// Reads a 64-bit varint.
fn read_varint(&mut self) -> ... |
use super::*;
use derivative::Derivative;
#[derive(Default, Debug)]
/// The Style of a Node. If feilds are None then the Context style is used
pub struct NodeArgs {
pub background: Option<egui::Color32>,
pub background_hovered: Option<egui::Color32>,
pub background_selected: Option<egui::Color32>,
pub ... |
//! Create middleware from async functions.
//!
//! See [`from_fn`] for more details.
use axum::{
body::{self, Bytes, HttpBody},
response::{IntoResponse, Response},
BoxError,
};
use http::Request;
use pin_project_lite::pin_project;
use std::{
any::type_name,
convert::Infallible,
fmt,
future... |
use stylist::{css, StyleSource};
use wasm_bindgen_test::*;
use web_sys::window;
use yew::prelude::*;
use yew::{utils, App};
pub enum Msg {
Clicked(MouseEvent),
}
/// # Navbar Item component
///
/// ## Features required
///
/// navbar
///
/// ## Example
///
/// ```rust
/// use yew::prelude::*;
/// use yew::service... |
/*
Copyright (c) 2016 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicen... |
// grrr clippy... you cannot specify extra bounds with the async fn syntax...
#![allow(clippy::manual_async_fn)]
// default implementations don't always make sense...
#![allow(clippy::new_without_default)]
#![deny(missing_docs)]
#![deny(unsafe_code)]
#![deny(warnings)]
//! sqlite/sqlcipher backed LairKeystore server c... |
// Copyright (c) 2013-2016 Sandstorm Development Group, Inc. and contributors
// Licensed under the MIT License:
//
// 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, inc... |
//! Racy System V mirrored memory allocation.
use super::mem;
use libc::{
c_int, c_void, mmap, munmap, shmat, shmctl, shmdt, shmget, shmid_ds,
sysconf, IPC_CREAT, IPC_PRIVATE, IPC_RMID, MAP_FAILED, MAP_PRIVATE,
PROT_NONE, _SC_PAGESIZE,
};
#[cfg(not(target_os = "macos"))]
use libc::MAP_ANONYMOUS;
#[cfg(tar... |
use napi::{CallContext, JsObject, JsUndefined, JsUnknown, Module, Result};
#[derive(Serialize, Debug, Deserialize)]
struct AnObject {
a: u32,
b: Vec<f64>,
c: String,
}
#[derive(Serialize, Debug, Deserialize, Eq, PartialEq)]
struct Inner;
#[derive(Serialize, Debug, Deserialize, Eq, PartialEq)]
struct Inner2(i32... |
mod utils;
extern crate js_sys;
extern crate fixedbitset;
use std::fmt;
use fixedbitset::FixedBitSet;
use wasm_bindgen::prelude::*;
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
// allocator.
#[cfg(feature = "wee_alloc")]
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc:... |
use crate::common::Span;
use core::fmt;
use core::fmt::Display;
use crate::error::{Diagnostic, Emitter, Label};
#[derive(Debug, Clone)]
pub struct Item {
pub content: String,
pub span: Span,
}
impl Item {
pub fn new(content: &str, span: Span) -> Self {
Item {
content: content.to_strin... |
//! Krylov subspace methods
use crate::types::*;
use ndarray::*;
pub mod arnoldi;
pub mod householder;
pub mod mgs;
pub use arnoldi::{arnoldi_householder, arnoldi_mgs, Arnoldi};
pub use householder::{householder, Householder};
pub use mgs::{mgs, MGS};
/// Q-matrix
///
/// - Maybe **NOT** square
/// - Unitary for ex... |
// Take a look at the license at the top of the repository in the LICENSE file.
#![cfg_attr(feature = "dox", feature(doc_cfg))]
#![allow(unknown_lints)]
#![allow(clippy::missing_safety_doc)]
#![allow(clippy::wrong_self_convention)]
#![allow(clippy::non_send_fields_in_send_ty)]
#![doc = include_str!("../README.md")]
p... |
use quick_error::quick_error;
use crate::{
file,
mutable::Target,
store::{
file::{find, loose},
packed,
},
};
quick_error! {
/// The error returned by [`loose::Reference::follow_symbolic()`].
#[derive(Debug)]
#[allow(missing_docs)]
pub enum Error {
FindExisting(... |
/*
* Created on Wed Dec 08 2021
*
* Copyright (c) storycraft. Licensed under the MIT Licence.
*/
use std::{borrow::Cow, env, error::Error, thread, time::Duration};
use futures::{AsyncRead, AsyncWrite};
use loco_protocol::secure::{
crypto::CryptoStore, session::SecureClientSession, stream::SecureStream,
};
use... |
use crate::{
config::text::Reader, config::Settings, model, render::object::Context as ObjectContext,
};
use wgpu;
use std::{collections::HashMap, fs::File};
pub type BoxSize = u8;
pub type Price = u32;
pub type Time = u16;
pub type Shield = u16;
#[derive(Clone, Debug)]
pub enum Kind {
Main,
Ruffa,
... |
use std::fmt::{self, Display};
use serde::{self, Deserialize, Serialize};
use super::names::{FnName, namer, Var};
use super::basic_types::{Type, Literal};
use super::instructions::Instr;
use super::operations::Op;
use super::super::transformers::cfg::Node;
use super::super::transformers::cfg::{connect_basic_blocks, con... |
use crate::utils::test_outside_container;
use anyhow::anyhow;
use oci_spec::runtime::LinuxBuilder;
use oci_spec::runtime::{LinuxHugepageLimitBuilder, LinuxResourcesBuilder};
use oci_spec::runtime::{Spec, SpecBuilder};
use std::path::PathBuf;
use test_framework::{ConditionalTest, TestGroup, TestResult};
fn check_hugetl... |
extern crate libc;
use x11::xlib;
use std::mem;
use std::ffi;
use std::ptr;
use super::super::libx;
use super::container::{self, Container};
const CWX: libc::c_uint = 1<<0;
const CWY: libc::c_uint = 1<<1;
const CWWidth: libc::c_uint = 1<<2;
const CWHeight: libc::c_uint = 1<<3;
const CWBorderWidth: libc::c_uint = 1<... |
// Copyright 2018 <NAME> <<EMAIL>>
// Licensed under the MIT License.
#![deny(missing_docs)]
//! "Borrow" the stdio streams temporarily, exposing them to a Tokio core as
//! nonblocking streams.
//!
//! As in many such implementations, the I/O is made nonblocking by spawning
//! threads to interact with the stdin and... |
use adventofcrustacean;
use itertools::Itertools;
use std::cmp;
type Bounds = [i32; 2];
#[derive(Debug,Clone)]
struct Step {
on: bool,
x: Bounds,
y: Bounds,
z: Bounds,
}
type Board = Vec<Vec<Vec<bool>>>;
fn parse_bound(s: &str) -> Bounds {
// x=10..12
let mut tmp = s.split("=");
assert_eq!... |
use crate::parse::AttrMeta;
use proc_macro::{Diagnostic, Level};
use proc_macro2::{Ident, TokenStream};
use quote::quote;
use std::collections::HashSet;
use std::convert::{TryFrom, TryInto};
use syn::{punctuated::Punctuated, FnArg, Lit, Meta, NestedMeta, Pat, Token};
const HEADER: &str = "header";
const BODY: &str = "... |
// Copyright (c) 2020 <NAME> <<EMAIL>>. All rights reserved.
// Use of this source is governed by Apache-2.0 License that can be found
// in the LICENSE file.
//! From include/uapi/linux/seccomp.h
use super::ioctl::*;
/// Valid values for seccomp.mode and prctl(PR_SET_SECCOMP, <mode>)
/// seccomp is not in use.
pub ... |
#[derive(Debug, Eq, PartialEq)]
pub struct GameBoard {
player1: u16,
player2: u16,
}
pub fn parse(input: &str) -> GameBoard {
let mut lines = input.lines();
let p1 = lines.next().expect("Missing line 1");
let p2 = lines.next().expect("Missing line 2");
let re =
regex::Regex::new(r"Play... |
pub mod palletes;
use crate::{fonts, pit, vga::{self}, terminal};
use core::ops::*;
use font8x8::UnicodeFonts;
const HEIGHT: usize = 480;
const WIDTH: usize = 640;
static mut VBLANK: bool = false;
pub fn vblank() {
unsafe {
VBLANK = true;
}
}
#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct Pixe... |
use crate::protocol::parts::type_id::TypeId;
use crate::protocol::util;
use byteorder::{LittleEndian, ReadBytesExt};
use std::rc::Rc;
use vec_map::VecMap;
pub(crate) type ResultSetMetadata = Vec<FieldMetadata>;
pub(crate) fn parse_resultset_metadata(
count: usize,
rdr: &mut dyn std::io::Read,
) -> std::io::R... |
use crate::bluetooth::{BluetoothCubeDevice, BluetoothCubeEvent};
use crate::common::{Cube, CubeFace, InitialCubeState, Move, TimedMove};
use crate::cube3x3x3::Cube3x3x3;
use anyhow::{anyhow, Result};
use btleplug::api::{Characteristic, Peripheral};
use std::str::FromStr;
use std::sync::{Arc, Mutex};
use uuid::Uuid;
st... |
// Copyright (c) 2020 <NAME>
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
//! [Cryst1](www.wwpdb.org/documentation/file-format-content/format33/sect8.html#CRYST1)
//! The CRYST1 record presents the unit cell parameters, space group, and Z value. If the
//! structure was... |
// Copyright © 2020 <NAME> and Rajeswari
// [This program is licensed under the "MIT License"]
// Please see the file LICENSE in the source
// distribution of this software for license terms.
///
/// This module will create Triangular fence and will validate if the given coordinates is within the fence or not
///
use ... |
fn main() {
let start = Instant::now();
let reactor = Reactor::new();
let fut1 = async {
let val = Task::new(reactor.clone(), 1, 1).await;
println!("Got {} at time: {:.2}.", val, start.elapsed().as_secs_f32());
};
let fut2 = async {
let val = Task::new(reactor.clone(), 2, 2... |
// This file is part of Substrate.
// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// 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 F... |
use super::timer::Timer;
use super::wgpu_utils::uniformbuffer::*;
use cgmath::prelude::*;
use enumflags2::{bitflags, BitFlags};
use winit::event::{DeviceEvent, ElementState, KeyboardInput, VirtualKeyCode, WindowEvent};
#[cfg_attr(rustfmt, rustfmt_skip)]
const OPENGL_PROJECTION_TO_WGPU_PROJECTION: cgmath::Matrix4<f32> ... |
mod error;
use clap::Clap;
use log::{debug, error, info, trace};
use futures::FutureExt;
use tokio::io;
use tokio::net::tcp::{OwnedReadHalf, OwnedWriteHalf};
use tokio::net::{TcpListener, TcpStream};
use tokio::runtime::Builder;
use error::CliErrors;
#[derive(Clap, Debug)]
struct LoggingOpts {
/// A level of ve... |
// Copyright 2017-2019 `multipart-async` Crate 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 distribute... |
//! Provides functionality for handling app routes.
use crate::app::{
PathAwareRequestHandler, RequestHandler, StatelessRequestHandler, WebsocketHandler,
};
use crate::http::cors::Cors;
use crate::krauss;
use crate::percent::PercentDecode;
use std::fs::metadata;
use std::path::PathBuf;
/// Represents a sub-app t... |
// Copyright 2022 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 anyhow::Result;
use fidl_fuchsia_developer_bridge as bridge;
use fidl_fuchsia_net as net;
use std::time::Duration;
use timeout::timeout;
/// Equivalen... |
// MIT License
//
// Copyright (c) 2020 <NAME>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merg... |
use serde::{Deserialize, Serialize};
use zksync_crypto::params::{
ACCOUNT_ID_BIT_WIDTH, ADDRESS_WIDTH, CHUNK_BYTES, CONTENT_HASH_WIDTH, ETH_ADDRESS_BIT_WIDTH,
FEE_EXPONENT_BIT_WIDTH, FEE_MANTISSA_BIT_WIDTH, SERIAL_ID_WIDTH, TOKEN_BIT_WIDTH,
};
use zksync_crypto::primitives::FromBytes;
use crate::operati... |
use anyhow::Result;
use clap::lazy_static::lazy_static;
use clap::{AppSettings, IntoApp, Parser};
use clap_complete::Shell;
use std::io;
use std::io::BufRead;
use std::path::{Path, PathBuf};
use std::str::FromStr;
use toml_bombadil::settings::Settings;
use toml_bombadil::{Bombadil, MetadataType, Mode};
macro_rules! fa... |
use crate::templating;
use anyhow::{
bail,
Error,
};
use chrono::{
DateTime,
NaiveDate,
Utc,
};
use core::ops::AddAssign;
use serde::{
Deserialize,
Serialize,
};
use std::{
collections::{
BTreeMap,
BTreeSet,
},
fmt,
iter::FromIterator,
ops::Add,
};
use ter... |
use crate::common::ColorLegend;
use ezgui::{
Color, Drawable, EventCtx, GeomBatch, GfxCtx, Line, MultiText, ScreenPt, ScreenRectangle, Text,
};
use geom::{Bounds, Circle, Distance, Duration, FindClosest, PolyLine, Polygon, Pt2D};
pub struct Plot<T> {
draw: Drawable,
legend: ColorLegend,
labels: MultiTe... |
use std::path::Path;
use crate::{build_tool_manager::BuildToolManager, project::ProjectFilter, Project};
use ignore::WalkBuilder;
use tracing::warn;
/// An iterator over [`Project`]s in and below a given directory.
pub fn projects_below<'a>(
path: &Path,
project_filter: &'a ProjectFilter,
build_tool_mana... |
use crate::ogc::util::{parse_ogc_bbox, parse_time_option, OgcBoundingBox};
use crate::util::{bool_option_case_insensitive, from_str};
use geoengine_datatypes::primitives::TimeInterval;
use geoengine_datatypes::spatial_reference::SpatialReference;
use serde::{Deserialize, Serialize};
// TODO: ignore case for field name... |
use crate::{matrix::Matrix, number::Number, Error, GenericOCL, Buffer, Node};
use super::{api::{enqueue_nd_range_kernel, set_kernel_arg}, CL_CACHE, CLCache, cl_device::InternCLDevice};
pub trait KernelArg<'a, T> {
fn buf(&'a self) -> Option<&'a Buffer<T>> {
None
}
fn number(&self) -> Option<T> {
... |
//! A structure which sieves for prime numbers and provides functions to iterate over the primes,
//! to get the nth prime and for querying whether a particular number is prime.
mod primefuncs;
use iterator;
use segsieve::segmented_sieve;
const MODULUS: u64 = 240;
enum SmallPrime {
Two,
Three,
Five,
... |
use std::io;
use std::io::{LineWriter, Stdout};
use std::panic::PanicInfo;
use backtrace::Backtrace;
use slog::{error, o, Drain, Fuse};
use slog_term::{FullFormat, PlainSyncDecorator};
use crate::Reaper;
pub fn create_std_logger() -> slog::Logger {
slog::Logger::root(slog_stdlog::StdLog.fuse(), o!())
}
pub fn c... |
use std::fmt::Debug;
use std::marker;
use std::ops::{Add, Mul, Sub};
use cgmath::{BaseFloat, EuclideanSpace, InnerSpace, Rotation, VectorSpace, Zero};
use core::{
resolve_contact, ApplyAngular, ContactEvent, Inertia, Mass, PartialCrossProduct,
PhysicalEntity, ResolveData, Velocity,
};
use core::{NextFrame, Pos... |
extern crate nom;
use self::nom::*;
use std::str;
// Quoted with " or single '
// then escapes quote, \ and n with \
named!(pub quoted_str<&str>, map_res!(alt_complete!(
delimited!(
tag!("\""),
escaped!(
is_not!("\\\""),
'\\',
one_of!("\"\\n")
),
... |
use sp_ipld::Ipld;
use std::fmt;
use crate::{
ipld_error::IpldError,
literal::Literal,
term::Term,
yatima,
};
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
pub enum BoolOp {
Eql,
Lte,
Lth,
Gte,
Gth,
And,
Or,
Xor,
Not,
}
impl BoolOp {
pub fn symbol(self) -> String {
match self {
... |
//! Code generation for the AXI interface.
use super::fsm;
use vast::v05::ast as v;
/// Represents the Direction of a channel
/// from the perspective of the master interface.
#[derive(Clone, Debug)]
pub(crate) enum ChannelDirection {
Recv,
Send,
}
/// Represents a single AXI channel.
#[derive(Clone, Debug)]
... |
#![doc = "generated by AutoRust"]
#![allow(non_camel_case_types)]
#![allow(unused_imports)]
use serde::de::{value, Deserializer, IntoDeserializer};
use serde::{Deserialize, Serialize, Serializer};
use std::str::FromStr;
#[doc = "The properties of the Canonical support plan."]
#[derive(Clone, Debug, PartialEq, Serialize... |
// Copyright 2020 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 {
argh::FromArgs,
chrono::{DateTime, Local},
chrono_english::{parse_date_string, Dialect},
diagnostics_data::Severity,
ffx_core::ff... |
use crate::{
conf::{BrokerConfig, FederatorConfig},
message::{self, Message, BEACONS, CORE_ANNS, FEDERATED_TOPICS, MEMB_ANNS, ROUTING_TOPICS},
worker::TopicWorkerHandle,
};
use paho_mqtt as mqtt;
use std::{collections::HashMap, sync::Arc, time::Duration};
use tokio::sync::RwLock;
use tracing::{error, info, ... |
use crossbeam_channel::*;
use gst;
use gst::prelude::*;
use std::sync::{Arc, Mutex};
use std::time::Duration;
use sunk::{Client, Streamable};
use sunk::song::Song;
use daemon::Command;
use error::Error;
use queue::Queue;
pub struct Player {
daemon_recv: Receiver<Command>,
daemon_send: Sender<Command>,
cli... |
mod header;
use gtk::prelude::*;
use gtk::Inhibit;
use gtk::WidgetExt;
use relm::{connect, init, Component, Relm, Widget};
use relm_derive::{widget, Msg};
use header::{Header, Msg as HeaderMsg};
use relm_moonrender::{Moonrender, Msg as MoonrenderMsg};
#[derive(Msg)]
pub enum Msg {
Quit,
Goto(String),
Go... |
use std::{collections::HashSet, convert::TryFrom};
use if_chain::if_chain;
use proc_macro2::{Ident, Span, TokenStream};
use quote::quote;
use syn::{
parse_macro_input, parse_quote, spanned::Spanned, Attribute, Data, DeriveInput, GenericParam,
Generics, Meta, Path, Type,
};
#[proc_macro_derive(CustomDebug, att... |
#![deny(warnings)]
extern crate curl;
#[macro_use]
extern crate failure;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
extern crate uuid;
mod types;
pub use self::types::*;
mod error;
use self::error::*;
use std::path::{Path, PathBuf};
use std::cell::RefCell;
use uuid::Uuid;
... |
extern crate bloom;
use crate::web_crawler::fetch::build_url;
use crate::web_crawler::robots::is_allowed_by_robots;
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
use std::thread;
use url::Url;
use bloom::BloomFilter;
use bloom::ASMS;
const THREADS: i32 = 20;
const MAX_URL_LENGTH: u32 = 100;
const MAX_L... |
//! The Subsequence Graph.
use crate::prelude::*;
use std::collections::BTreeSet;
// =============
// === Graph ===
// =============
/// A graph vertex.
///
/// The vertices are identified by two indexes: a layer index and text's char index. See
/// `Graph` docs for details.
///
/// The field order is significant,... |
fn main() {
ownership();
reference_borrowing();
// find_first_word_index();
let s = String::from("hello world");
let hello = &s[0..5];
let world = &s[6..11];
let slice1 = &s[0..2];
let slice2 = &s[..2];
let len = s.len();
let slice3 = &s[3..len];
let slice4 = &s[3..];
... |
// Copyright 2017 yasuhara <<EMAIL>>
//
// 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 http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except accord... |
use std::fmt;
use std::io::BufRead;
use super::Error;
use super::Field;
use super::Method;
use super::RequestStatus;
use super::Version;
#[derive(Debug, PartialEq)]
pub struct Request {
line: RequestStatus,
fields: Vec<Field>,
}
impl Request {
pub fn new(line: RequestStatus, fields: Vec<Field>) -> Request... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.