text stringlengths 3.09k 13.9k |
|---|
// https://github.com/GREsau/schemars/pull/65
#![allow(clippy::field_reassign_with_default)]
// From `CustomResource`
#![allow(clippy::default_trait_access)]
use std::collections::BTreeMap;
use chrono::{DateTime, Utc};
use kube::CustomResource;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
mod schem... |
//! The Watch API provides an event-based interface for asynchronously monitoring changes to keys.
//!
//! # Examples
//!
//! Watch key `foo` changes
//!
//! ```no_run
//! use tokio::stream::StreamExt;
//!
//! use etcd_rs::*;
//!
//! #[tokio::main]
//! async fn main() -> Result<()> {
//! let client = Client::connec... |
/* Copyright (c) 2019-2021 <NAME> <<EMAIL>>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This pro... |
use crate::message::{MessageData, MessageDirection};
use crate::{
border::BorderBuilder,
core::{math::vec2::Vec2, pool::Handle},
message::{ButtonState, OsEvent, PopupMessage, UiMessage, UiMessageData, WidgetMessage},
node::UINode,
widget::{Widget, WidgetBuilder},
BuildContext, Control, NodeHandl... |
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
mod r#async;
mod cursor;
pub use self::{cursor::*, r#async::*};
use std::{
ops::{BitAnd, Deref},
slice, str,
};
use cocoa::{
appkit::{NSApp, NSWindowStyleMask},
base::{id, nil},
foundation::{NSAuto... |
extern crate gradient;
extern crate image;
extern crate raytracer;
#[macro_use]
extern crate serde;
use raytracer::*;
use raytracer::math::*;
use raytracer::colours;
use std::env;
use std::sync::Arc;
mod custom {
use raytracer::math::{Vec3d, vec3};
use raytracer::object::{Raymarchable, IFS};
use std::ve... |
use super::io::BoxedIo;
use crate::transport::{
server::{Connected, TlsStream},
Certificate, Identity,
};
#[cfg(feature = "tls-roots")]
use rustls_native_certs;
use std::{fmt, sync::Arc};
use tokio::io::{AsyncRead, AsyncWrite};
#[cfg(feature = "tls")]
use tokio_rustls::{
rustls::{ClientConfig, NoClientAuth,... |
use std::collections::{VecDeque, HashMap};
use std::fs::{self, File, DirBuilder};
use std::fs::DirEntry;
use std::io::{self, Write};
use std::io::BufRead;
use std::process;
use std::path::PathBuf;
use hyper::body::HttpBody;
use hyper::{Client, Uri};
use hyper_tls::HttpsConnector;
use crate::config::Config;
use crate:... |
// Copyright (c) 2016-2020 <NAME>
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(unused_imports)]
use crate::syntax::ast::{self, NodeId};
use moore_common::name::*;
use moore_common::source::*;
use std;
use std::collections::{HashMap, HashSet};
#[derive(Debug)]
pub struct SymTbl {
next_id: usize,
p... |
//! # Utilities and helper functions
//! Various helper functions used throughout the `bio-jtools` crate
use crate::align;
use crate::fastx;
use bam::{BamReader, BamWriter, SamReader, SamWriter};
use std::path::{Path, PathBuf};
#[derive(Clone, Copy, PartialEq)]
pub enum Hts {
Align(Align),
Fastx(Fastx),
V... |
use std::ffi::CString;
use std::io::{self, BufWriter, Write, Seek, SeekFrom};
use std::fs::File;
use lazy_static::lazy_static;
use super::bbi_zoom::ZOOM_LEVELS;
use super::bbi_utils::*;
use super::BbiBlock;
const BBI_HEADER_SIZE: u64 = 64;
const EXT_HEADER_SIZE: u64 = 64;
const ZOOM_HEADER_SIZE: u64 = 24;
const TOTA... |
//! Shamir's secret-sharing scheme using our Galois-field types
//!
//! Shamir's secret-sharing scheme is an algorithm for splitting a secret into
//! some number of shares `n`, such that you need at minimum some number of
//! shares `k`, to reconstruct the original secret.
//!
//! More information on how Shamir's secr... |
use crate as pdf;
use crate::object::*;
use crate::error::*;
#[derive(Object, Debug)]
struct RawFunction {
#[pdf(key="FunctionType")]
function_type: u32,
#[pdf(key="Domain")]
domain: Vec<f32>,
#[pdf(key="Range")]
range: Option<Vec<f32>>,
#[pdf(other)]
other: Dictionary
}
#[derive(Ob... |
//! `TypeEnvironment` and related types.
use std::{collections::HashMap, iter::FromIterator, ops};
use crate::{
arith::{
Constraint, ConstraintSet, MapPrimitiveType, Num, NumArithmetic, ObjectSafeConstraint,
Substitutions, TypeArithmetic,
},
ast::TypeAst,
error::Errors,
types::{Par... |
// Miniscript
// Written in 2019 by
// <NAME> and <NAME>
//
// To the extent possible under law, the author(s) have dedicated all
// copyright and related and neighboring rights to this software to
// the public domain worldwide. This software is distributed without
// any warranty.
//
// You should have received a... |
use crate::{
common_utils::common::macros::{fx_err_and_bail, with_line},
cpu_ctrl::types::SerializableCpuPerformanceStateInfo,
};
use anyhow::Error;
use fidl_fuchsia_hardware_cpu_ctrl::{DeviceMarker, DeviceProxy};
use fuchsia_syslog::macros::*;
use glob::glob;
use parking_lot::{RwLock, RwLockUpgradableReadGuard... |
use crate::func::{get_generic_argument_type, OutputBindings};
use azure_functions_shared::codegen::{bindings::TRIGGERS, last_segment_in_path};
use azure_functions_shared::util::to_camel_case;
use proc_macro2::TokenStream;
use quote::{quote, ToTokens};
use syn::{FnArg, Ident, ItemFn, Pat, Type};
const INVOKER_PREFIX: &... |
use crate::surface::{EdgeLoop, Surface};
use crate::utils;
use crate::{Float, Point2, Point3, Quat, TriangleMesh, Vec3};
#[derive(Debug)]
pub struct Cylinder {
pub origin: Point3,
pub axis: Vec3,
/// Normalized direction for angle start
pub ref_dir: Vec3,
pub radius: Float,
}
impl Cylinder {
p... |
use rustc::ty::{self, TyCtxt};
use rustc::hir::def_id::DefId;
use rustc::traits::{self, Reveal};
use rustc::ty::subst::Substs;
use rustc::ty::fold::TypeFoldable;
use syntax::ast::{Name, DUMMY_NODE_ID};
use syntax::codemap::DUMMY_SP;
// The following is 99% from Miri (terminator.rs), with error handling from rustc tra... |
// Copyright 2022 The Tari Project
// SPDX-License-Identifier: BSD-3-Clause
use std::{io, time::Duration};
use crossterm::{
cursor,
event::{Event, EventStream, KeyCode, KeyEvent, KeyModifiers},
terminal,
};
use futures::{FutureExt, StreamExt};
use rustyline::{config::OutputStreamType, error::ReadlineError... |
use super::*;
#[derive(
Copy, Clone, Eq, PartialEq, Debug, Display, Ord, PartialOrd, FromStr, Deserialize, Serialize,
)]
#[serde(transparent)]
pub(crate) struct Ordinal(pub(crate) u64);
impl Ordinal {
pub(crate) const LAST: Self = Self(Self::SUPPLY - 1);
pub(crate) const SUPPLY: u64 = 2099999997690000;
pub(c... |
/// Manage conversion of a user provided string
/// defining foreground and background colors into
/// a string with TTY colors
use {
crate::errors::InvalidSkinError,
crossterm::style::{
Attribute::{self, *},
Attributes,
Color::{self, *},
},
std::result::Result,
super::*,
... |
// Copyright (C) 2019-2021 Crust Network Technologies Ltd.
// This file is part of Crust.
//! Crust-specific RPCs implementation.
use std::sync::Arc;
use crust_runtime::opaque::Block;
use crust_primitives::{BlockNumber, AccountId, Index, Balance, Hash};
use sp_api::ProvideRuntimeApi;
use txpool_api::TransactionPool;... |
use backend::*;
struct RoomBuilder {
rects: Vec<Rect>,
rooms: Vec<Rect>,
}
impl RoomBuilder {
fn new() -> Box<Self> {
Box::new(Self {
rects: Vec::new(),
rooms: Vec::new(),
})
}
}
impl MapGen for RoomBuilder {
fn setup(&mut self) {}
fn build(&mut self) ... |
// Copyright 2017 PingCAP, Inc.
//
// 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 i... |
use std::thread::sleep;
use std::time::Duration;
use thiserror::Error;
use crate::position::Position;
use crate::window::Window;
use regex::Regex;
use std::fs::File;
use std::path::Path;
use std::sync::mpsc::{Receiver, Sender};
pub fn input_loop(sender: &Sender<String>) {
let terminal_name = "relocator:";
loo... |
//! Data Co-Processor (DCP)
//!
//! The DCP supports the following operations
//!
//! - AES-128, in ECB and CBC modes
//! - SHA-256
//! - SHA-1
//!
//! Only SHA-256 & AES-128 in ECB mode are currently exposed
//!
//! **NOTE** The DCP is only available on the i.MX6UL**Z** chip
// References: section 13 of MX28RM
use c... |
//! Readers and writers for the [Real-time Transport Protocol].
//!
//! *These are included when using the `"rtp"` feature.*
//!
//! [Real-time Transport Protocol]: https://tools.ietf.org/html/rfc3550
use crate::wrap::*;
use pnet_macros::packet;
use pnet_macros_support::{packet::PrimitiveValues, types::*};
#[packet]
... |
use std::path::Path;
use failure::{err_msg, format_err, Error, Fallible};
use protobuf::Message;
use rand::Rng;
use sticker_tf_proto::{ConfigProto, RewriterConfig_Toggle};
use tensorflow::Status;
/// Tensorflow requires a path that contains a directory component.
pub(crate) fn prepare_path<P>(path: P) -> Fallible<Str... |
use std::marker::PhantomData;
#[cfg(feature = "sgx")]
use std::prelude::v1::*;
use std::sync::Arc;
use async_io::event::{Events, Pollee};
use futures::future::BoxFuture;
use io_uring_callback::Fd;
use itertools::Itertools;
#[cfg(feature = "sgx")]
use sgx_untrusted_alloc::UntrustedAllocator;
use crate::file::AsyncFile... |
use crate::core::mipmap::MIPMap;
use crate::core::spectrum::{RGBSpectrum, Spectrum, SpectrumType};
use crate::core::geometry::point::{Point3f, Point2i, Point2f};
use crate::core::transform::Transform;
use crate::core::pbrt::{Float, PI, INFINITY};
use crate::core::geometry::bounds::Bounds2f;
use crate::core::medium::Med... |
use std::collections::HashMap;
use hyper::Body;
use reinda::{assets, Setup};
use serde_json::json;
use crate::{config::Config, prelude::*};
use super::Response;
const ASSETS: Setup = assets! {
#![base_path = "../frontend/build"]
"index.html": { template },
"bundle.js": {
template,
hash,... |
// Copyright (c) 2019 Blacknon. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
// TODO(blacknon): 単語単位でのdiffを行えるようにする
// 参考:
// - https://github.com/tk0miya/diff-highlightf
// TODO(blacknon): 2つの出力を並べてdiffをする機能について追加検討
// TODO(blacknon): l... |
#![allow(dead_code)]
use crate::file_reader::{FileReader, FileReaderParam};
use crate::file_writer::{FileWriter, FileWriterParam};
use crate::general_error::Error;
use std::fmt;
use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering;
use std::sync::Arc;
use std::sync::Barrier;
use std::sync::Mutex;
use std:... |
extern crate futures;
extern crate raft_consensus;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate toml;
#[macro_use]
extern crate clap;
#[macro_use]
extern crate slog;
extern crate tokio;
extern crate slog_async;
extern crate slog_term;
extern crate net2;
extern crate raft_tokio;
use std:... |
use crate::{
implementation::{NormalizedCentralMoments, SealedSupportedOrder, Storage},
Central, Index, Moments, Order, Scalar, SupportedIndex, SupportedOrder,
};
/// The normalized central moments of an image or contour which are translational and scale invariant.
#[derive(Debug, Clone, PartialEq)]
pub struct... |
#![allow(improper_ctypes)]
use crate::function::{wrap_into_pyfunction, Function};
use crate::instance::Instance;
use crate::memory::Memory;
use crate::module::Module;
use pyo3::exceptions::Exception;
use pyo3::prelude::*;
use pyo3::types::{PyAny, PyBytes, PyDict, PySet};
use pyo3::wrap_pyfunction;
use std::rc::Rc;
use... |
use super::QuakeWad;
use gdnative::{
godot_error, godot_print, godot_wrap_method_inner,
godot_wrap_method_parameter_count, init::ClassBuilder, methods, FromVariant, Instance,
NativeClass, ProjectSettings, Resource, Variant, VariantArray, GodotString,
};
const PALETTE: &str = "P:/Personal/Rust/hello_cargo/s... |
use std::sync::Arc;
use fp::prime::ValidPrime;
use fp::vector::FpVector;
use once::OnceVec;
use crate::algebra::combinatorics::TruncatedPolynomialMonomialBasis;
use crate::algebra::AdemAlgebraT;
use crate::algebra::{PolynomialAlgebra, PolynomialAlgebraMonomial, PolynomialAlgebraTableEntry};
use crate::module::Polynom... |
use ash::vk;
use crate::buffer::StagingBuffer;
use crate::vk_engine::VulkanEngine;
use ash::vk::{ImageLayout, ImageMemoryBarrier};
use ash::Device;
/// A Texture struct. Holds a vk::Image and information about its format, extent and number of layers.
pub struct Texture {
pub format: vk::Format,
pub image: vk... |
mod config;
mod parser;
use config::*;
use notify::{watcher, DebouncedEvent, RecursiveMode, Watcher};
use parser::*;
use std::{
env, fmt,
fs::{self, File},
io::{self, Write},
path::Path,
path::PathBuf,
process,
sync::mpsc::channel,
time::Duration,
};
fn main() {
let mut args = env:... |
use std::str::FromStr;
pub const PUNCT_DOTDOTDOT: &[char] = &[ '.', '.', '.', ];
pub const PUNCT_FATARROW: &[char] = &[ '=', '>', ];
pub const PUNCT_INCREMENT: &[char] = &[ '+', '+', ];
pub const PUNCT_DECREMENT: &[char] = &[ '-', '-', ];
pub const PUNCT_AND: &[char] = &[ '&', '&', ];
pub c... |
use clap::Clap as _;
use rayon::prelude::*;
use std::io::Write as _;
#[derive(clap::Clap, Debug)]
struct Opts {
/// additional C compiler arguments
#[clap(
long,
allow_hyphen_values = true,
multiple_occurrences = true,
number_of_values = 1
)]
ccadd: Vec<String>,
///... |
//! Local Exceptions.
use std::{io, fs, thread};
use std::path::{Path, PathBuf};
use std::sync::{Arc, Weak};
use std::time::{Duration, SystemTime};
use arc_swap::ArcSwap;
use futures::future::{select, Either, FutureExt};
use rpki::slurm::{SlurmFile, ValidationOutputFilters};
use serde::Deserialize;
use crate::payload;... |
use std::{
collections::HashMap,
collections::HashSet,
fmt::Display,
ops::{Add, Div, Mul, Sub},
};
use serde::{Deserialize, Serialize};
use super::histogram::{Histogram, Iter, IterMut, ValuesMut};
use crate::{axis::Axis, error::BinaryOperationError, Item};
/// A sparse N-dimensional [Histogram] that ... |
mod authors;
mod crate_type;
mod os_arch;
mod project_name;
use crate::{emoji, Args};
use anyhow::Result;
use console::style;
use regex::Regex;
use serde::Deserialize;
use std::{collections::HashMap, fmt::Display, fs, path::Path};
use toml::Value;
pub use authors::{get_authors, Authors};
pub use crate_type::CrateTyp... |
// Copyright 2018 The Exonum Team
//
// 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 i... |
#![feature(proc_macro_hygiene)]
extern crate proc_macro;
use proc_macro::TokenStream;
use proc_macro2::TokenTree;
use syn::{parse_macro_input, braced, Token};
use syn::parse::{Parse, ParseStream, Result};
use quote::{quote, format_ident};
use std::ops::Range;
struct SeqInput {
ts: TokenStream,
}
fn contains_loo... |
mod common;
use common::{random_keypair, CommonError};
use anyhow::Error;
use async_trait::async_trait;
use bytes::Bytes;
use creep::Context;
use futures::{
channel::mpsc::{channel, Receiver},
SinkExt, StreamExt, TryStreamExt,
};
use tracing::{debug, error};
use wormhole::{
bootstrap::{self, BootstrapProt... |
use crate::{
api::{ListParams, Meta, ObjectList, Resource, WatchEvent},
Client, Error, Result,
};
use futures::{lock::Mutex, StreamExt, TryStreamExt};
use serde::de::DeserializeOwned;
use tokio::time::delay_for;
use std::{collections::BTreeMap, sync::Arc, time::Duration};
/// Internal representation for Refle... |
/*
* // Copyright (c) 2016-2019, Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp.
* // Copyright (c) 2020-present, Jaguar0625, gimre, BloodyRookie.
* // All rights reserved.
* //
* // This file is part of Catapult.
* //
* // Catapult is free software: you can redistribute it and/or modify
* // it under the t... |
pub use crate::backend::buffer::{Buffer, BufferKey};
use crate::backend::{self};
use crate::{vk, vulkan::*};
use ash::version::DeviceV1_0;
use snoozy::*;
use std::mem::size_of;
#[snoozy]
pub async fn upload_buffer_snoozy<T: Sized + Copy + Send + Sync + 'static>(
_ctx: Context,
contents: &T,
) -> Result<Buffer... |
use bktree::BkTree;
use eyre::{Context, Result};
use image::io::Reader as ImageReader;
use img_hash::{HashAlg, HasherConfig, ImageHash};
use rayon::prelude::*;
use std::{
cmp::Ordering,
collections::HashSet,
ffi::OsString,
fs::{self, File},
io::{Cursor, Read},
path::{Path, PathBuf},
};
use struc... |
use crate::{CoordFloat, Point};
use geographiclib_rs::{DirectGeodesic, Geodesic, InverseGeodesic};
/// Returns a new Point along a route between two existing points on an ellipsoidal model of the earth
pub trait GeodesicIntermediate<T: CoordFloat> {
/// Returns a new Point along a route between two existing point... |
// Copyright 2022, The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// di... |
use std::sync::Arc;
use failure::ResultExt;
use mongodb::sync::Client;
use opentracingrust::Tracer;
use slog::info;
use slog::Logger;
use replicante_externals_mongodb::version as detect_version;
use replicante_externals_mongodb::MongoDBHealthCheck;
use replicante_models_core::admin::Version;
use replicante_service_he... |
// Copyright 2015-2021 <NAME> <<EMAIL>>
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according... |
use bincode;
use context::Context;
use error::Error;
use fixed::MutFixed;
use layer::{Layer, LayerStack, Parent};
use result::Result;
use serde::ser::{Serialize, Serializer};
use std::ptr;
use vec::SafeVec;
/// Execution type.
#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)]
pub enum ExecType {
ParallelS... |
use std::iter;
use either_n::Either2;
use inflector::cases::snakecase::to_snake_case;
use proc_macro::TokenStream;
use proc_macro2::Span;
use quote::quote;
use syn::{
parse::ParseStream, parse_macro_input, parse_quote, punctuated::Punctuated, Arm, Data,
DeriveInput, Lit, LitStr, Meta, MetaNameValue, NestedMeta... |
use async_trait::async_trait;
use bitflags::bitflags;
use libunftp::auth::{AuthenticationError, Credentials, DefaultUser, UserDetail};
use serde::Deserialize;
use std::fmt::Formatter;
use std::path::PathBuf;
/// The unFTP user details
#[derive(Debug, PartialEq)]
pub struct User {
pub username: String,
pub name... |
//! Kairoi's database, responsible for storing jobs and rules, and triggering jobs execution.
//!
//! The Database is one of the 3 mains components of the Kairoi architecture. It uses channels to
//! receive queries from the Controller, to send query responses to the Controller, to send
//! execution requests to the Pr... |
use rand;
use rand::Rng;
use std::ffi::OsString;
use std::fs::File;
use std::fs::OpenOptions;
use std::io;
use std::io::BufReader;
use std::io::BufWriter;
use std::io::Read;
use std::io::Stderr;
use std::io::Write;
use structopt::StructOpt;
use super::Error;
use super::Result;
#[derive(Debug, StructOpt)]
#[structopt(a... |
use itertools::Itertools;
use smol_str::SmolStr;
#[inline(always)]
pub fn lower_case(s: &str) -> SmolStr {
s.chars()
.map(|c| c.to_lowercase().collect::<String>())
.collect::<SmolStr>()
}
#[inline(always)]
pub fn upper_case(s: &str) -> SmolStr {
s.chars()
.map(|c| c.to_uppercase().coll... |
use crate::descriptor::{Package, TypePath};
#[derive(Debug)]
pub struct Resolver<'a> {
extern_types: &'a [(String, String)],
retain_enum_prefix: bool,
package: &'a Package,
}
impl<'a> Resolver<'a> {
/// Creates a new resolver for `package`
pub fn new(
extern_types: &'a [(String, String)],
... |
use camera_components::{Camera3DManager, Camera2DManager};
use uuid::Uuid;
use gl_context::{Context, Program};
use gl_geometry::GLGeometry;
use geometry::Geometry;
use material::Material;
use scene_graph::Id;
use scene_renderer::{SceneRenderer, Plugin};
use hash_map::HashMap;
use insert::Insert;
use map::Map;
use... |
mod button;
mod cover_art;
mod game_form;
mod header;
use nile::Tile;
use yew::prelude::*;
use crate::{
app,
components::{utils::update_if_changed, Container, EmptyCell, RackTile},
};
use button::{ClickButton, LinkButton};
use game_form::GameForm;
use header::Header;
pub struct Landing {
props: Props,
}
... |
use std::collections::HashMap;
use std::error;
use std::fmt;
use nipper::{Document, Selection};
#[derive(Debug, Clone)]
pub struct HtmlParsingError;
impl fmt::Display for HtmlParsingError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(
f,
"found unexpected HTML st... |
use std::collections::{HashMap, HashSet};
use std::fs::File;
use std::io::Read;
use std::path::Path;
use iced::Column;
use iced_futures::Command;
use serde::{Serialize, Deserialize};
use crate::action::{Action, flow, ID};
use crate::comm::{Message, Sender};
use crate::global::Global;
use crate::util::{timestamp, async... |
use core::cmp;
use std::ffi::{OsStr, OsString};
use itertools::Itertools;
use sysinfo::{DiskExt, DiskType, System, SystemExt};
use crate::files::FileLen;
use crate::path::Path;
use rayon::{ThreadPool, ThreadPoolBuilder};
use std::collections::HashMap;
pub struct DiskDevice {
pub index: usize,
pub name: OsStr... |
use crate::event;
use crate::event::Event;
use crate::renderer::{Message, RenderInstruction};
use crate::util::{Color, Queue, Vector2D};
use crate::widget::{Layout, Widget};
use std::cell::RefCell;
use std::rc::Weak;
#[derive(Clone)]
pub struct TextBoxWidget {
/// The textbox's identifier
id: usize,
... |
use bitflags::bitflags;
use std::{fmt, io, marker, ops};
use crate::timestamp::Timestamp;
/// Buffer type
///
/// Specific types of devices require buffers of corresponding types.
#[allow(clippy::unreadable_literal)]
#[rustfmt::skip]
#[repr(u32)]
pub enum BufferType {
VideoCapture = 1,
VideoOutput ... |
//---------------------------------------------------------------------------//
// Copyright (c) 2017-2020 <NAME>. All rights reserved.
//
// This file is part of the Rusted PackFile Manager (RPFM) project,
// which can be found here: https://github.com/Frodo45127/rpfm.
//
// This file is licensed under the MIT license... |
use std::{collections::HashMap, convert::TryFrom, sync::atomic::Ordering::SeqCst};
use anyhow::{anyhow, Result};
use ckb_chain_spec::consensus::ConsensusBuilder;
use ckb_script::{TransactionScriptsVerifier, TxVerifyEnv};
use ckb_traits::{CellDataProvider, HeaderProvider};
use ckb_types::core::{
cell::{CellMeta, Ce... |
use std::fs;
use common::utility::print_solution;
#[derive(Clone, Copy, Debug)]
enum Number {
Empty,
Single(u32),
Pair,
}
impl Number {
fn is_empty(&self) -> bool {
match self {
Number::Empty => true,
_ => false,
}
}
fn is_pair(&self) -> bool {
... |
use deno_core::plugin_api::Buf;
use deno_core::plugin_api::Interface;
use deno_core::plugin_api::Op;
use deno_core::plugin_api::ZeroCopyBuf;
use rusqlite::{Connection, types::ValueRef, types::Value as SqliteValue};
use std::cell::RefCell;
use std::collections::HashMap;
use serde::{Deserialize, Serialize};
use serde_... |
use std::rc::Rc;
use byteorder::{LittleEndian, WriteBytesExt};
use encoding::{
codec::{utf_16, utf_8},
Encoding as EncodingTrait,
};
use failure::{bail, ensure, Error};
use crate::{
chunks::TOKEN_STRING_TABLE,
model::{owned::OwnedBuf, StringTable},
};
#[derive(Clone, Copy, PartialEq, Debug)]
pub enum... |
use crate::virtio::fpga::fpga_map_region::{FpgaMapRegion, MapRegionRequest};
use crate::virtio::fpga::protocol::*;
use crate::virtio::fpga::utils::generate_pfn;
use crate::virtio::fpga::Error;
use logger::{debug, error};
use mem_control::address_allocator::Alloc;
use mem_control::{MemRequest, VmMemRequest, VmMemRespons... |
use std::convert::TryInto;
use std::io::Read;
use std::mem::{size_of, zeroed};
use std::ptr::{null, null_mut};
#[cfg(windows)]
use winapi::{
self,
shared::devpkey::{
DEVPKEY_Device_Class,
DEVPKEY_Device_FriendlyName,
DEVPKEY_Device_LocationInfo,
DEVPKEY_Device_Manufacturer,
... |
use ferris_says::say;
use std::io::{stdout, BufWriter};
// --- Day 6: Lanternfish ---
// The sea floor is getting steeper. Maybe the sleigh keys got carried this way?
// A massive school of glowing lanternfish swims past. They must spawn quickly to reach such large numbers - maybe exponentially quickly? You should m... |
//! Core abstractions of the Real-Time Interrupt-driven Concurrency (RTIC) framework
//!
//! You can write generic *libraries* using the `Mutex` trait in this crate. If you want to write
//! application code then you'll need an *implementation* of the RTIC framework for a particular
//! architecture. Currently, there a... |
/*!
# Day 1: Report Repair
After saving Christmas five years in a row, you've decided to take a vacation
at a nice resort on a tropical island. Surely, Christmas will go on without
you.
The tropical island has its own currency and is entirely cash-only. The gold
coins used there have a little picture of a starfish; t... |
// Copyright (c) 2018-2022 The MobileCoin Foundation
use crate::{common::*, LibMcError};
use core::convert::TryFrom;
use libc::ssize_t;
use mc_crypto_box::{generic_array::typenum::Unsigned, CryptoBox, VersionedCryptoBox};
use mc_crypto_keys::{ReprBytes, Ristretto, RistrettoPrivate, RistrettoPublic};
use mc_crypto_sig:... |
use std::collections::HashMap;
use std::io::{BufReader, BufWriter};
use std::net::{TcpStream,SocketAddr};
use std::time::Duration;
use std::sync::{Arc, Mutex};
use native_tls::TlsConnector;
use std::io::prelude::*;
use rayon::prelude::*;
use super::setting::PortDatabase;
use std::net::{IpAddr, Ipv4Addr};
/// Struct fo... |
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
use core::convert::TryInto;
use ring::aead;
use s2n_quic_core::crypto::{
self,
retry::{IntegrityTag, NONCE_BYTES, SECRET_KEY_BYTES},
CryptoError,
};
lazy_static::lazy_static! {
/// Compute the ... |
use crate::tuple::Tuple;
pub struct Canvas {
pub width: usize,
pub height: usize,
canvas: Vec<Tuple>,
}
impl Canvas {
pub fn new(w: usize, h: usize) -> Canvas {
let c = vec![Tuple::color(0.0, 0.0, 0.0); w * h];
Canvas {
width: w,
height: h,
canvas: c... |
use super::{Config, Configure, DecodeError};
use crate::dict::FieldLocation;
use crate::dict::IsFieldDefinition;
use crate::{Dictionary, FixValue, GetConfig};
use crate::{RandomFieldAccess, RepeatingGroup};
use serde::{Deserialize, Serialize};
use std::borrow::{Borrow, Cow};
use std::collections::HashMap;
/// A read-o... |
macro_rules! doc {
(
$doc:expr,
$($item:tt)+
) => {
#[doc = $doc]
$($item)+
}
}
/// Represents a `Fresh` GIF's thumb.
pub struct GifThumb {
url: String,
mime: &'static str,
}
impl GifThumb {
/// Constructs a JPEG thumb.
#[must_use]
pub fn jpeg(url: impl ... |
use anyhow::{anyhow, Result};
use clap::{crate_version, App, Arg, SubCommand};
use std::ffi::OsStr;
/// List all the available plugins/helper scripts
fn list_helpers() -> Result<Vec<String>> {
let exe_dir = std::env::current_exe()?;
let exe_dir = exe_dir.parent().ok_or_else(|| anyhow!("Where am I?"))?;
let... |
use fnv::FnvHashMap;
use std::sync::{Arc, Mutex, Condvar};
use std::fmt::{Display, Formatter, Result as FmtResult}; //避免和标准Result冲突,改名为FmtResult
use threadpool::{ThreadPool, Builder as ThreadPoolBuilder};
use task_pool::TaskPool;
use task::Task;
use worker::{WorkerStatus, WorkerType, Worker};
/*
* 工作者池
... |
use opengl_graphics::{Texture, TextureSettings, GlGraphics, OpenGL, GlyphCache};
use piston::input::{RenderArgs, UpdateArgs, Button};
use piston::input::Button::Keyboard;
use piston::input::keyboard::Key;
use graphics::Context;
use std::path::PathBuf;
use std::rc::Rc;
use std::cell::RefCell;
use super::gamestate::Game... |
//
//! Copyright 2020 Alibaba Group Holding Limited.
//!
//! 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 ... |
use configparser::{AutoEmojiTrigger, Config, GuildConfig};
use dotenv::dotenv;
use emojicache::EmojiCache;
use serenity::client::Client;
use serenity::model::channel::Message;
use serenity::model::gateway::Ready;
use serenity::model::guild::GuildStatus;
use serenity::model::id::GuildId;
use serenity::model::interaction... |
//! Implements the main interface struct necessary in order to consume, parse and detect binary
//! inputs. Should be used to detect format and security mitigations for a singular binary.
#![allow(clippy::match_bool)]
use crate::check::{Analyze, GenericMap};
use crate::errors::{BinError, BinResult};
use crate::rules;
... |
use std::collections::HashSet;
use std::ops::Index;
use iced_x86::Register::{self, *};
use crate::context::Context;
use crate::error::Diagnostic;
use crate::node::{Function, Identifier, Parameter, Size, ValueNode};
use crate::span::Span;
#[derive(Debug, Copy, Clone)]
pub enum Mode {
Protected = 32,
Long = 64,
Rea... |
use crate::alloc::borrow::ToOwned;
use crate::error::ProtoErrorKind;
use crate::message::{
ChannelName, ChatCapabilitiesFlags, NowChatMsg, NowChatSyncMsg, NowChatTextMsg, NowString65535, NowVirtualChannel,
};
use crate::sm::{ChannelResponses, ProtoState, SMData, SMEvent, SMEvents, VirtualChannelSM};
use alloc::boxe... |
// Now we do not need to genetate the constants module using the Python script.
// mod constants;
// pub use constants::*;
include!(concat!(env!("OUT_DIR"), "/constants.rs"));
use std::path::Path;
pub const DEFAULT_ICON: char = '';
pub const FOLDER_ICON: char = '';
pub const DEFAULT_FILER_ICON: char = '';
// Each... |
//! All the errors that can be caused by this crate.
use miette::Diagnostic;
use thiserror::Error;
use crate::ErrTypeTraits;
/// This enum contains all the possible errors that could be returned
/// by [`handle_shutdown_requests()`](crate::Toplevel::handle_shutdown_requests).
#[derive(Error, Debug, Diagnostic)]
pub ... |
use crate::prelude::*;
use std::cell::RefCell;
use std::marker::PhantomData;
use crate::{write, Buffer, VecBuffer};
/// Utility trait used to simplify the formatting of optional objects that are formattable.
///
/// In order to take advantage of all the functions, you only need to implement the [FormatOptionalTokenAn... |
use crate::systems::render_ui_stage::HaRenderUiStageSystemCache;
use oxygengine_core::prelude::*;
use oxygengine_ha_renderer::prelude::*;
use oxygengine_user_interface::raui::core::{
layout::{CoordsMapping, Layout},
renderer::Renderer,
widget::unit::{
text::{TextBoxHorizontalAlign, TextBoxVerticalAl... |
use point::Point;
// Intersection of p, p+r and q, q+s
// For details, See: http://stackoverflow.com/questions/563198/how-do-you-detect-where-two-line-segments-intersect
// p + t r = q + u s
// t = ((q − p) × s) / (r × s)
// u = ((q − p) × r) / (r × s)
pub fn lines_intersect(l1: [f64; 4], l2: [f64; 4]) -> bool {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.