text
stringlengths
3.09k
13.9k
//! The module defines the `Future` trait, as well as a simple struct that wraps any type T //! and implements the `Future` trait. /// The trait represents a value that will become available in the future. /// Concrete implementations of the trait only need to provide the implementation of the /// `await` method, whic...
use crate::audio::{GenericAudioSpecs}; use super::{AudioSample, AudioBuffer,PcmConverter}; use super::super::{ErrorKind,Result}; use std::io::Read; use std::mem; use std::slice; macro_rules! convert_and_copy { ( $src_type:ident, $dst_type:ident, $data_slice:ident , $convert_closure:expr ) => {{ return uns...
//! Provides the `AdaBoost*` by Rätsch & Warmuth, 2005. use crate::{Data, Sample}; use crate::{Classifier, CombinedClassifier}; use crate::BaseLearner; use crate::Booster; /// Struct `AdaBoostV` has 4 parameters. /// /// - `tolerance` is the gap parameter, /// - `rho` is a guess of the optimal margin, /// - `gamma`...
pub use http_ws::Message; use std::{ cell::RefCell, io, pin::Pin, task::{Context, Poll}, }; use futures_core::{ready, stream::Stream}; use futures_util::sink::Sink; use http_ws::Codec; use xitca_http::bytes::{Buf, BytesMut}; use xitca_io::io::AsyncWrite; use super::{connection::ConnectionWithKey, err...
use crate::payout_curve::basis_eval::*; use crate::payout_curve::csr_tools::CSR; use crate::payout_curve::utils::*; use crate::payout_curve::Error; use core::cmp::max; use ndarray::concatenate; use ndarray::prelude::*; use ndarray::s; #[derive(Clone, Debug)] pub struct BSplineBasis { pub knots: Array1<f64>, pu...
use super::structs::*; use crate::fields::distance::parse_raw_degree; use crate::fields::parameter::parse_dbhz; use crate::parser_utils::*; use nom::sequence::tuple; use nom::IResult; pub fn parse_talker(input: &str) -> IResult<&str, Talker> { if input.len() < 2 { return Err(nom::Err::Failure((input, nom::...
use std::convert::TryFrom; use std::str::FromStr; use std::{env, fs}; use nom::branch::alt; use nom::bytes::complete::tag; use nom::character::complete::{alpha1, digit1, space1}; use nom::combinator::{map, map_res, recognize}; use nom::multi::separated_list0; use nom::sequence::{delimited, pair, preceded, terminated};...
//! wchar implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/wctype.h.html use crate::{ c_str::CStr, header::ctype, platform::types::*, }; use self::casecmp::casemap; mod alpha; mod casecmp; mod punct; pub type wctype_t = u32; pub const WEOF: wint_t = 0xFFFF_FFFFu32; p...
use crate::matrix_3d::Matrix3D; use amethyst::renderer::rendy::mesh::{Normal, Position, TexCoord}; use lazy_static::lazy_static; use ron::from_str; use serde::Deserialize; use std::fs; use amethyst::core::math::{ Vector2, Vector3, //Matrix3 }; lazy_static! { static ref TRIANGULATION: Triangulation = { ...
use std::{collections::HashMap, marker::PhantomData}; use buffers::{ByteBuf, ByteString}; use clone_to_owned::CloneToOwned; use serde::Deserializer; use crate::serde_bencode_de::from_bytes; pub fn dyn_from_bytes<'de, BufT>(buf: &'de [u8]) -> anyhow::Result<BencodeValue<BufT>> where BufT: From<&'de [u8]> + std::h...
pub use self::entry::*; pub use self::mapper::Mapper; pub use self::temporary_page::TemporaryPage; use core::ops::{Deref, DerefMut, Add}; use core::fmt; use core::fmt::Debug; pub use memory::{PAGE_SIZE, Frame, FrameAllocator, VirtualAddress}; pub mod entry; mod table; mod temporary_page; pub mod mapper; const ENTRY...
// day4 parse time: [753.47 us 758.95 us 765.43 us] // day4 part 1 time: [27.518 us 27.814 us 28.163 us] // day4 part 2 time: [40.731 us 41.412 us 42.272 us] use std::collections::BTreeMap; static KEYS: [&str; 7] = ["byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid"]; static EC...
use std::{collections::{HashSet}, fs::File, io::{self, BufRead}, path::Path, str::FromStr}; #[derive(Debug, Clone, Hash, PartialEq, Eq)] struct Cave { name: String, small: bool, start: bool, end: bool, } #[derive(Debug, Clone, Hash, PartialEq, Eq)] struct Line { a: Cave, b: Cave, start: bo...
//! Parses FEN notation into game state. use board::piece::Piece; use board::player::Player; use board::square::Square; use rules::castle_rights::CastleRights; use rules::game_state::GameState; use rules::player_board::PlayerBoard; use std::cmp::max; use std::str::FromStr; /// Parses a given FEN string. /// /// A FEN...
use word::{Word, UnsignedWord, ToWord}; use word::is_pow2::*; /// Reverses groups of bits within each subword of `x`. /// /// * `group_bit_size` - The size (in bits) of the groups of bits to be /// reversed. /// * `no_subwords` - The number of subwords in `x`. /// /// The word `x` is divided into `no_subwords`. The bi...
macro_rules! aw { ($e:expr) => { tokio_test::block_on($e) }; } #[cfg(test)] #[macro_use] extern crate pretty_assertions; #[test] fn tests_can_run() { assert_eq!(2 + 2, 4); } #[path = "../src/config.rs"] mod conf; #[path = "../src/table.rs"] mod table; mod config { use super::*; #[test] fn ...
extern crate bindgen; extern crate cc; extern crate num_cpus; use bindgen::Builder; use std::env; use std::io::Write; use std::path::Path; use std::path::PathBuf; use std::process::Command; const PHP_VERSION: &'static str = concat!("php-", env!("CARGO_PKG_VERSION")); /// println_stderr and run_command_or_fail are co...
use webrender::api::*; use glutin; use style::{Theme, BuiltTheme, BuiltTextBlock, BuiltBlock, BuiltImageBlock}; use fasternet_common::{Block}; use fasternet_common::markdown::parse_markdown; use std::fs::File; use std::collections::HashMap; use std::io::Read; use std::path::Path; use rayon::prelude::*; pub struct App ...
// 我们开始学习动态规划吧 use std::cmp::min; // https://leetcode-cn.com/problems/maximum-subarray // 最大子序各,好像看不出什么动态规则的意味,反而像滑动窗口 pub fn max_sub_array(nums: Vec<i32>) -> i32 { let mut sum = nums[0]; let mut ans = nums[0]; for i in 1..nums.len() { if sum > 0 { // add positive sum means larger ...
use std::io::{Read, Seek, Cursor, SeekFrom, Result}; use std::collections::HashMap; use std::iter::FromIterator; use byteorder::{ReadBytesExt, LittleEndian}; use utils::stream::*; use loader::pe::{DataDirectory, Section, PEFile}; use loader::code::*; use metadata::heap::{StringHeap, UserStringHeap, BlobHeap, Heaps};...
//! this module provides tracking for which chunks need to be meshed. //! //! this tracking is needed because we can only mesh a chunk properly when all //! 26 neighboring chunks are loaded, so directly meshing a chunk when a ["chunk //! added" event][crate::common::world::ChunkEvent] is received is off the //! table. ...
//! Base Station Report (type 4) use super::navigation::*; use super::parsers::*; use super::radio_status::{parse_radio, RadioStatus}; use super::types::*; use super::AisMessageType; use crate::errors::Result; use nom::bits::{bits, complete::take as take_bits}; use nom::combinator::map; use nom::IResult; #[derive(Debu...
//! Implements Erlang process, an independent computing unit of Erlang with //! heap, stack, registers, and message queue. use crate::{ defs::exc_type::ExceptionType, emulator::{ code_srv::CodeServer, heap::{copy_term, Designation, Heap}, mailbox::ProcessMailbox, mfa::{ModFunArgs, ModFunArity}, ...
//! This is a DNS server implementation that returns the given gateway address for //! every request. This will be recognised by most mobile phones and browsers as //! a captive portal. mod byte_buffer; mod dns_header; mod dns_packet; mod dns_query; mod dns_record; use byte_buffer::BytePacketBuffer; use dns_header::R...
use super::Nickname; use crate::machine::{Machine, Machines}; use crate::{FantochFeature, RunMode, Testbed}; use color_eyre::eyre::WrapErr; use color_eyre::Report; use std::collections::HashMap; const MACHINES: &str = "exp_files/machines"; const PRIVATE_KEY: &str = "~/.ssh/id_rsa"; pub fn create_launchers( region...
use std::{ cell::{Cell, RefCell}, fs, path::{Path, PathBuf}, sync::Once, time::Duration, }; use crossbeam_channel::{after, select, Receiver}; use flexi_logger::Logger; use lsp_server::{Connection, Message, Notification, Request}; use lsp_types::{ notification::{DidOpenTextDocument, Exit}, r...
use crate::objects::TcbObj; use crate::prelude::*; use crate::syscall::{MsgInfo, RespInfo}; use core::fmt::{Debug, Error, Formatter}; const EL1h: usize = 0b0101; const EL0t: usize = 0b0000; const AARCH64: usize = 0b0 << 4; const FIRQ_MASK: usize = 0b1 << 6; #[repr(C)] #[derive(Default, Clone)] pub struct TrapFrame { ...
use crate::sinks::HealthcheckError; use futures01::{Future, Stream}; use goauth::scopes::Scope; use goauth::{ auth::{JwtClaims, Token, TokenErr}, credentials::Credentials, GoErr, }; use hyper::{header::AUTHORIZATION, StatusCode}; use reqwest::Client; use serde::{Deserialize, Serialize}; use smpl_jwt::Jwt; u...
// Copyright (c) 2018-2021 The MobileCoin Foundation //! Database storage for subaddress indices //! * A lookup table, mapping subaddress_spend_public_key to monitor_id and subaddress index. //! This is used by the ledger sync code, allowing it to match TxOuts into specific monitor_ids. use crate::{ database_ke...
//! Show toggle controls using checkboxes. use std::hash::Hash; use crate::event::{self, Event}; use crate::layout; use crate::mouse; use crate::row; use crate::text; use crate::{ Align, Clipboard, Element, Hasher, HorizontalAlignment, Layout, Length, Point, Rectangle, Row, Text, VerticalAlignment, Widget, }; ...
// Copyright 2021 <NAME>. // // 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 writ...
pub mod day_12 { use std::collections::{HashMap, HashSet}; #[derive(Debug)] pub struct Cave<'a> { is_big: bool, _name: &'a str, } #[derive(Debug)] pub struct CaveSystem<'a> { caves: Vec<Cave<'a>>, /// The 0th element is the set of caves you can hit from caves[0...
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may...
#[doc = "Reader of register IMR2"] pub type R = crate::R<u32, super::IMR2>; #[doc = "Reader of field `WRDY`"] pub type WRDY_R = crate::R<bool, bool>; #[doc = "Reader of field `ENDTX`"] pub type ENDTX_R = crate::R<bool, bool>; #[doc = "Reader of field `TXBUFE`"] pub type TXBUFE_R = crate::R<bool, bool>; #[doc = "Reader ...
#[macro_use] extern crate askama; #[macro_use] extern crate failure; #[macro_use] extern crate lazy_static; #[macro_use] extern crate log; #[macro_use] extern crate serde_derive; extern crate byteorder; extern crate chrono; extern crate criterion; extern crate criterion_stats; extern crate git2; extern crate glob; ext...
//! This is the parser used to write and read data from the underlying stream. We created a //! dedicated file for this so we can change the data parsing without affecting any of TCP //! connection structure. //! //! At the moment we are using a length-prefix framing approach, so, for each data written to the //! TCP s...
// Copyright (c) 2021 <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, distri...
//! Helper functions for creating fire-and-forget special effect animations like explosions and bullet flares. use std::time::Duration; use bevy::prelude::*; use crate::game::GameTimeDelta; use super::beams::BeamTracking; struct AnimatedEffectPrefabs { small_explosion: AnimatedEffectData, small_muzzle_flar...
use assets::Asset; use failure::Error; use gl; use graphics::textures::{ MaxFilterMode, MinFilterMode, Texture, TextureFormat, TextureOptions, WrapMode, }; use maths::Vector4f; use rayon::iter::{IntoParallelRefIterator, ParallelIterator}; use rusttype::{ self, gpu_cache::{Cache, CacheBuilder}, Point, Po...
use crate::session::Session; use ihex; use std::error::Error; use std::fmt; use std::fs::File; use std::io::{Read, Seek, SeekFrom}; use std::path::Path; use super::*; pub struct BinOptions { /// Memory address at which to program the binary data. If not set, the base /// of the boot memory will be used. b...
use anyhow::{bail, Context, Result}; use std::{collections::HashMap, path::Path}; use super::controller::Controller; use crate::cgroups::{ common, stats::{parse_single_value, supported_page_sizes, HugeTlbStats, StatsProvider}, }; use oci_spec::{LinuxHugepageLimit, LinuxResources}; pub struct HugeTlb {} impl ...
use clap::{ArgEnum, Parser}; #[derive(Parser)] struct Args { #[clap(long, arg_enum, multiple_values = true)] datasets: Vec<Dataset>, #[clap(long, arg_enum, multiple_values = true)] libraries: Vec<Library>, } #[derive(ArgEnum, Clone)] enum Dataset { #[clap(name = "allstate")] Allstate, #[clap(name = "boston")] ...
use crate::runner::{ create_unknown_node_in_tree_diagnostic, TestCase, TestCaseFiles, TestRunOutcome, TestSuite, }; use regex::Regex; use rome_js_syntax::AstNode; use rome_rowan::api::SyntaxKind; use rslint_parser::{parse, SourceType}; use serde::Deserialize; use std::io; use std::path::Path; const BASE_PATH: &str...
use crate::ffi::bindings::*; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; use thiserror::Error; #[derive(Debug, Clone, Eq, PartialEq, Hash)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub enum Bits { U32(u32), U64(u64), } /// An `NvmlError` with an optionally present sour...
/* Copyright 2016 <NAME> 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 distri...
use crate::custom::credential::NewAwsCredsForStsCreds; use crate::{AssumeRoleWithWebIdentityRequest, Sts, StsClient}; use rusoto_core::credential::{ AwsCredentials, CredentialsError, ProvideAwsCredentials, Secret, Variable, }; use rusoto_core::request::HttpClient; use rusoto_core::{Client, Region}; use async_trait...
use std::{path::PathBuf, pin::Pin, time::Duration}; use async_trait::async_trait; use bytes::{Bytes, BytesMut}; use futures::{stream::BoxStream, SinkExt, StreamExt}; use serde::{Deserialize, Serialize}; use snafu::{ResultExt, Snafu}; use tokio::{net::UnixStream, time::sleep}; use tokio_util::codec::Encoder; use vector...
#![warn(clippy::all)] #![warn(clippy::pedantic)] #![warn(clippy::cargo)] #![warn(clippy::needless_borrow)] #![allow(clippy::let_underscore_drop)] // https://github.com/rust-lang/rust-clippy/pull/5998#issuecomment-731855891 #![allow(clippy::map_err_ignore)] #![allow(clippy::option_if_let_else)] #![allow(unknown_lints)] ...
use super::{super::json, session::SessionSendError}; use async_tungstenite::tungstenite::Message as TungsteniteMessage; use futures_channel::mpsc::UnboundedSender; use serde::{Deserialize, Serialize}; use std::{ collections::VecDeque, convert::TryInto, sync::{ atomic::{AtomicU32, AtomicU64, Ordering...
// Copyright (c) Facebook, Inc. and its affiliates. // Copyright (c) 2021-2022 Toposware, Inc. // // This source code is licensed under the MIT license found in the // LICENSE file in the root directory of this source tree. use super::{AirContext, Assertion, ConstraintDivisor}; use math::{ExtensionOf, FieldElement}; u...
use crate::interpreter::query_interpreters::nested_pagination::NestedPagination; use crate::{interpreter::InterpretationResult, query_ast::*}; use connector::{self, filter::Filter, ConnectionLike, QueryArguments, ReadOperations, ScalarCompare}; use prisma_models::{ManyRecords, ModelProjection, RecordProjection, Relatio...
mod continuation; use std::collections::HashSet; use std::sync::{Arc, Mutex}; use anyhow::Result; use chrono::NaiveDateTime; use chrono::{DateTime, Utc}; use continuation::get_continuation; use holostats_config::CONFIG; use holostats_database::Database; use holostats_request::{LiveChatMessage, RequestHub}; use holost...
use cgmath::{Deg, InnerSpace, Matrix3, Matrix4, Point3, Rad, Vector3}; pub struct Camera { /// Position of this camera in world coordinates pub location: Point3<f32>, /// A unit vector in the direction this camera is facing pub direction: Vector3<f32>, /// Near clipping plane for the perspective ...
use pyo3::{exceptions, ffi::*, prelude::*, types::PyAny, AsPyPointer}; use serde::{ ser::{self, Serialize, SerializeMap, SerializeSeq}, Serializer, }; use crate::{string, types}; use std::ffi::CStr; pub const RECURSION_LIMIT: u8 = 255; #[derive(Clone)] pub enum ObjectType { Str, Int, Bool, No...
//! This module provides all needed types and methods to create/load sound buffers from different sources. //! //! # Overview //! //! Buffer is data source for sound sources in the engine. Each sound sound will fetch samples it needs //! from a buffer, process them and send to output device. Buffer can be shared across...
use alienware::{Alienware, Zone}; use argparse::{ArgumentParser, Store, StoreTrue}; use json::object; use lazy_static::lazy_static; use regex::Regex; use std::io::ErrorKind; use std::process::exit; /// Struct containing the parsed command line arguments struct Options { show_version: bool, json: bool, hdmi...
//! Statement nodes use toc_span::SpanId; use crate::{expr, item, symbol, ty}; pub use crate::ids::{BodyStmt, StmtId}; #[derive(Debug, PartialEq, Eq)] pub struct Stmt { pub kind: StmtKind, pub span: SpanId, } #[derive(Debug, PartialEq, Eq)] pub enum StmtKind { /// An item declared in statement position ...
//! Demonstration of controlling two RGB LEDs to display a rainbow and //! moving 5 servos simultaneously. //! //! You can see a video of this program running here: //! https://blog.eldruin.com/pca9685-pwm-led-servo-controller-driver-in-rust/ //! //! This example is runs on the STM32F103 "Bluepill" board using I2C1. //...
//! Custom resolution for external references. use crate::{Export, ExportFunctionMetadata, ImportError, LinkError}; use more_asserts::assert_ge; use wasmer_types::entity::{BoxedSlice, EntityRef, PrimaryMap}; use wasmer_types::{ExternType, FunctionIndex, ImportIndex, MemoryIndex, ModuleInfo, TableIndex}; use wasmer_vm...
use crate::video::decode::Decoder; use crate::video::pixel::CastFromPrimitive; use crate::video::pixel::Pixel; use crate::video::{ChromaSamplePosition, ChromaSampling, FrameInfo, PlaneData}; use std::io::Read; use std::{cmp, mem}; fn get_chroma_sampling<R: Read>( dec: &y4m::Decoder<'_, R>, ) -> (ChromaSampling, Ch...
// Bitcoin Hashes Library // Written in 2018 by // <NAME> <<EMAIL>> // // 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 r...
// Copyright 2019 Parity Technologies (UK) Ltd. // This file is part of substrate-subxt. // // subxt 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) an...
// 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 { anyhow::{format_err, Error}, fidl_fuchsia_bluetooth_bredr as bredr, fuchsia_bluetooth::profile::{DataElement, ProtocolDescriptor, Service...
//! Bindings for `ANativeActivity` //! //! See also [the NDK //! docs](https://developer.android.com/ndk/reference/struct/a-native-activity.html) //use num_enum::{IntoPrimitive, TryFromPrimitive}; use std::ffi::CStr; use std::os::raw::c_void; use std::ptr::NonNull; /// An `ANativeActivity *` /// /// This is either pr...
#![allow(unused_imports)] #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; use crate::core::{Candle, Error, Method, MovingAverageConstructor, PeriodType, Source, OHLCV}; use crate::core::{IndicatorConfig, IndicatorInstance, IndicatorResult}; use crate::helpers::MA; use crate::methods::Cross; /// Moving...
extern crate winapi; use crate::packet; use crate::util::UnsafeHandle; use crate::wintun_raw; use crate::Adapter; use crate::Wintun; use once_cell::sync::OnceCell; use winapi::shared::winerror; use winapi::um::errhandlingapi::GetLastError; use winapi::um::handleapi; use winapi::um::synchapi; use winapi::um::winbase;...
//! Abstraction to perform asynchronous calculations & queries without blocking UI //! //! This opens a `crossbeam` `channel` to communicate with a backend. //! Each backend operation is send and retrieved in a loop on a thread. //! This allows sending operations into `Link` and retrieving the contents //! asynchronous...
//! Miniscript extension: ver_eq //! Note that this fragment is only supported for Segwit context //! You are most likely looking for taproot direct tx introspection use std::fmt; use MiniscriptKey; use elements::{self, encode::serialize}; use miniscript; use Extension; use ForEach; use TranslatePk; use ToPublicKey...
mod utils; use std::fmt; use wasm_bindgen::prelude::*; use std::collections::VecDeque; use rand; // 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::WeeAlloc::INIT; #[wasm_bindgen] #...
use std::collections::HashMap; use std::collections::HashSet; use std::fs; use std::path::{Path, PathBuf}; use super::graph::Graph; use crate::compile::Compile; use crate::error::{CompileError, ModelError}; use include_dir::{include_dir, Dir}; use n3_parser::ast; use n3_parser::parser; #[cfg_attr(feature = "serde", ...
// SPDX-License-Identifier: Apache-2.0 //! SGX microarchitecture-specific structures and constants. //! //! Only minimal functionality is provided by this module. //! //! Chapter 34 of the Intel SDM contains detailed documentation for these //! structs. //! //! Guidelines for updating this file: //! * Only use primiti...
///! Routines for manipulating `syn::Type`s. use proc_macro2::Span; use syn::{ parse_quote, punctuated::Punctuated, AngleBracketedGenericArguments, BareFnArg, Binding, GenericArgument, ParenthesizedGenericArguments, Path, PathArguments, PathSegment, QSelf, ReturnType, Token, Type, TypeArray, TypeBareFn, Ty...
//! Abstractions for deferred interrupt tasks, a companion to regular interrupt handlers. //! //! Deferred interrupt tasks are similar to the concept of "top half" and "bottom half" //! interrupt handlers in other OSes, in which the top half is the short, latency-sensitive //! function that runs immediately when the in...
use crate::types::*; use crate::errors::*; use uuid::Uuid; /// Represents a user #[derive(Debug, Clone, Default, Serialize, Deserialize)] pub struct User { #[doc(hidden)] #[serde(rename(serialize = "@type", deserialize = "@type"))] td_name: String, #[doc(hidden)] #[serde(rename(serialize = "@extra", dese...
use super::SAME_ITEM_PUSH; use clippy_utils::diagnostics::span_lint_and_help; use clippy_utils::path_to_local; use clippy_utils::source::snippet_with_macro_callsite; use clippy_utils::ty::{implements_trait, is_type_diagnostic_item}; use if_chain::if_chain; use rustc_data_structures::fx::FxHashSet; use rustc_hir::def::{...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Comparator Control Register 0"] pub cpctl0: CPCTL0, #[doc = "0x02 - Comparator Control Register 1"] pub cpctl1: CPCTL1, _reserved2: [u8; 2usize], #[doc = "0x06 - Comparator Interrupt Control Register"] pub cpint...
//! SAM header reference sequence MD5 checksum. use std::{error, fmt, ops::Deref, str::FromStr}; /// A SAM header reference sequence MD5 checksum. #[derive(Clone, Copy, Debug, Default, Eq, PartialEq)] pub struct Md5Checksum([u8; 16]); impl Deref for Md5Checksum { type Target = [u8]; fn deref(&self) -> &Self...
use crate::rendering::Instance; use anyhow::{bail, Context, Result}; use ash::{extensions::khr::Surface, version::InstanceV1_0, vk, vk::Handle}; use std::{ cell::RefCell, ptr::null, sync::{mpsc::Receiver, Arc}, }; pub type EventReceiver = Receiver<(f64, glfw::WindowEvent)>; /// Resources required for ren...
use super::prelude::*; use serde::{ de::{Deserialize, Deserializer, MapAccess}, ser::{Serialize, SerializeMap, Serializer}, }; use std::borrow::Cow; use std::collections::BTreeMap; use std::fmt; use std::ops::Not; #[derive(Debug, Clone, PartialEq)] pub struct ObjectContent { pub fields: BTreeMap<String, Fi...
use crate::ast::Span; use crate::diagnostics::DatamodelError; use crate::{PrimaryKeyDefinition, WithDatabaseName}; use datamodel_connector::Connector; use dml::model::{IndexDefinition, Model}; use dml::relation_info::RelationInfo; use once_cell::sync::Lazy; use regex::Regex; pub(crate) struct ConstraintNames; impl Co...
// Copyright 2020 <NAME> // 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, so...
use std::{ cmp::Ordering, fmt::{Debug, Display, Formatter}, ops::Add, slice::SliceIndex, }; use crate::{ location::Location, utf8_parser::{IOk, IResultLookahead}, }; #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum Offset { Absolute(usize), Relative(usize), } impl Add<usize> for ...
extern crate proc_macro; #[macro_use] mod error; mod gen; use crate::error::{DeriveError, DeriveResult}; use crate::gen::InputType; use proc_macro::TokenStream; use proc_macro2::{TokenStream as TokenStream2}; #[cfg(feature = "dump-expansions--unstable")] use proc_macro2::{Ident as Ident2}; use quote::quote; #[cfg(fea...
use crate::error::*; /// # Examples /// /// ``` /// # use adventofcode::solution:: /// # { /// # y2020::D4Pt2 as Solution, /// # Solution as S, /// # }; /// # env_logger::init(); /// let valid = "pid:087499704 hgt:74in ecl:grn iyr:2012 eyr:2030 byr:1980\n\ /// hcl:#623a2f\n\ /// \n\ /// eyr:2029 ec...
use native_tls::{Certificate, Identity, TlsConnectorBuilder}; use openssl::{ pkcs12::Pkcs12, pkey::{PKey, Private}, x509::X509, }; use serde::{Deserialize, Serialize}; use snafu::{ResultExt, Snafu}; use std::convert::TryFrom; use std::fmt::Debug; use std::fs::File; use std::io::Read; use std::path::{Path, P...
// Copyright (c) 2017, Sabre developers // // Licensed under the Apache License, Version 2.0 (see LICENSE.Apache in the // root directory) or MIT license (see LICENSE.MIT in the root directory), // at your option. This file may be copied, distributed, and modified only // in accordance with the terms specified by the c...
use core::fmt; use core::result::Result; use crate::elf::{ABIVersion, ElfHeaderFlags, ElfVersion, GenElf, GenElfHeader, GenProgramHeader, GenSectionHeader, ProgramFlags}; use crate::elf::elf_type::{ABI, ElfEndian, ElfKind, ElfMachine, ElfType, ProgramType, SectionType}; use crate::elf::flags::SectionHeaderFlags; pub ...
use crate::error::CmdError::ParsingError; use crate::error::CmdResult; pub struct FragmentIter { original: String, current_position: usize, } impl FragmentIter { pub fn new(original: String) -> Self { Self { original, current_position: 0, } } pub(self) fn t...
mod loom; mod ticket; mod waker; mod handle; pub mod actions; use std::io; use std::rc::Rc; use std::pin::Pin; use std::sync::Arc; use std::ptr::NonNull; use std::cell::RefCell; use std::time::Duration; use std::future::Future; use std::task::{ Context, Poll }; use std::os::unix::io::AsRawFd; use futures_task as task;...
//! Filesystem APIs implemenation using libc use crate::fs::{FileSystem, HostErrno, HostMode, HostOpenFlags, HostStat, IOResult}; use std::{convert::TryFrom, ffi::CString, mem::MaybeUninit}; /// A filesystem implementation that delegates all calls to libc. Basically, /// this lets you use the operating system's notio...
#![allow(unsafe_code)] use std::{ fmt::{self, Debug}, ops::Deref, sync::atomic::Ordering::{Acquire, Release}, }; use crossbeam_epoch::{unprotected, Atomic, Guard, Owned, Shared}; use crate::debug_delay; /// A node in the lock-free `Stack`. #[derive(Debug)] pub struct Node<T: Send + 'static> { pub(cr...
use super::common::{BooleanDiff, OptionalStringDiff, StringListDiff}; use crate::openapi::{ReferenceOr, Schema}; use serde::Serialize; use std::collections::{BTreeMap, HashMap, HashSet}; #[derive(Debug, Serialize, Default)] pub struct SchemaDiff { pub type_changed: Option<OptionalStringDiff>, pub description_c...
pub mod battery; pub mod fcs; pub mod imu; pub mod inputs; pub mod ins; pub mod osd; pub mod pathset; pub mod peripherals; pub mod yaml; use core::{mem, slice}; use fixed_point::fixed; use crate::{ io::Read, types::sensor::{Bias, Gain}, }; pub use battery::Battery; pub use fcs::FCS; pub use imu::IMU; pub use...
use crate::common::util::*; // spell-checker:ignore (ToDO) coreutil // These tests run the GNU coreutils `(g)groups` binary in `$PATH` in order to gather reference values. // If the `(g)groups` in `$PATH` doesn't include a coreutils version string, // or the version is too low, the test is skipped. // The reference ...
use ark_ec::{models::TEModelParameters, PairingEngine}; use ark_plonk::{ circuit::Circuit, constraint_system::StandardComposer, error::Error, prelude::Variable, }; use ark_std::{marker::PhantomData, vec::Vec, One, Zero}; #[derive(Debug, Default)] struct SetMembershipCircuit<E: PairingEngine, P: TEModelParameters<Base...
use crate::ast::*; use crate::resources::script::*; struct StatementBuilder { root: bool, result: String, indentation: usize, } pub fn build_script(s: Script) -> String { let source = &s.source; let mut builder = StatementBuilder::new(true, 0); builder.argument_vars(&source.args); builder.build_stateme...
// Copyright 2021 <NAME>. // // 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 writ...
use std::collections::HashMap; use std::hash::Hash; use std::ops::Deref; use std::path::Path; use serde::de; use serde::{Deserialize, Deserializer, Serialize}; use users::get_current_username; use validator::{Validate, ValidationError as ValidationErrorType}; use crate::error::{ColmenaResult, ColmenaError}; pub mod ...
use std::mem::replace; use bytes::{Buf, BufMut}; use crate::entry::Key; use SetOption::*; #[derive(Debug, Clone)] pub enum SetOption { UpdateOrInsert, FindOrInsert, } pub struct Leaf<K, V, const SIZE: usize> { pub next: u16, pub prev: u16, pub entries: Vec<(K, V)>, } impl<K: Key, V: Key, const SIZE: usize> Le...
use regex::Regex; type Coords = (i32, i32, i32); pub fn manhattan_distance(coords: &Coords) -> u32 { (coords.0.abs() + coords.1.abs() + coords.2.abs()) as u32 } fn has_same_parity(first: &Coords, second: &Coords) -> bool { vec![ (first.0, second.0), (first.1, second.1), (first.2, seco...