text stringlengths 8 4.13M |
|---|
#[doc = "Reader of register NEXT_EV"]
pub type R = crate::R<u8, super::NEXT_EV>;
#[doc = "Reader of field `in`"]
pub type IN_R = crate::R<bool, bool>;
#[doc = "Reader of field `out`"]
pub type OUT_R = crate::R<bool, bool>;
#[doc = "Reader of field `setup`"]
pub type SETUP_R = crate::R<bool, bool>;
#[doc = "Reader of fi... |
extern crate bytes;
extern crate env_logger;
extern crate futures;
extern crate h2;
extern crate http;
extern crate tokio;
use h2::server;
use bytes::*;
use futures::*;
use http::*;
use tokio::net::TcpListener;
pub fn main() {
let _ = env_logger::try_init();
let listener = TcpListener::bind(&"127.0.0.1:592... |
use std::iter;
use std::i16;
use itertools::Itertools;
use num_integer;
use num_traits::{Float, NumCast, PrimInt};
use encode::EncodeError;
/// Run-length encoding.
///
/// Run-length decoding can generally be used to compress arrays that contain
/// stretches of equal values. Instead of storing each value itself, str... |
#![allow(non_snake_case)]
// Copyright 2018 by Kzen Networks
// (https://github.com/KZen-networks/curv)
// License MIT: <https://github.com/KZen-networks/curv/blob/master/LICENSE>
//! Fast Multiparty Threshold ECDSA with Fast Trustless Setup
//! In a verifiable secret sharing scheme, auxiliary information is published... |
//!# Fermentable
//!
//!The term "fermentable" encompasses all fermentable items that contribute substantially to the beer including extracts, grains, sugars, honey, fruits.
use crate::utils;
use brew_calculator::units::*;
use serde::{Deserialize, Deserializer};
#[derive(Deserialize, Debug, PartialEq)]
#[serde(rename_... |
use ast;
use lalrpop_util;
use lexer;
use symbol;
use tiger;
pub fn parse(s: &str) -> Result<(Box<ast::Exp>, Box<symbol::SymbolTable>),
lalrpop_util::ParseError<usize, lexer::Token, ()>> {
let mut st = Box::new(symbol::SymbolTable::new());
let p;
{
let l = lexer::Lexer::new(s, &mut st);
... |
/// pada file trait_as_param.rs kita sudah menggunakan fungsi dengan parameternya trait
/// dengan menggunakan syntax `impl NamaTrait` pada parameternya
///
/// Nah trait_bound.rs ini akan mempersingkat syntax dari `trait_as_param.rs` menggunakan trait
/// bound syntax
/// trait bound syntax diletakkan sebagai generic... |
// TODO:
// - Macro to bind event and store id? Ideally we should have the FS core remember the
// events this module registered and the core can then unregister them, the same way
// it works for module applications and APIs
// - Refactor code to avoid using so many static globals and hide the ugliness
// of Arc... |
//! Code generation for [GraphQL object][1].
//!
//! [1]: https://spec.graphql.org/October2021#sec-Objects
pub mod attr;
pub mod derive;
use std::{any::TypeId, collections::HashSet, marker::PhantomData};
use proc_macro2::TokenStream;
use quote::{format_ident, quote, ToTokens};
use syn::{
ext::IdentExt as _,
... |
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
use crate::{Span, Word};
use gcode::{Callbacks, Mnemonic};
use wasm_bindgen::prelude::wasm_bindgen;
#[wasm_bindgen]
extern "C" {
pub type JavaScriptCallbacks;
#[wasm_bindgen(method)]
fn unknown_content(this: &JavaScriptCallbacks, text: &str, span: Span);
#[wasm_bindgen(method)]
fn gcode_buffer_ov... |
use async_nats::jetstream;
use tokio_stream::StreamExt;
use std::{env, str::from_utf8};
#[tokio::main]
async fn main() -> Result<(), async_nats::Error> {
let nats_url = env::var("NATS_URL").unwrap_or("nats://127.0.0.1".to_string());
let durable_name = env::var("DURABLE_NAME").unwrap_or("consumer1".to_string(... |
// Used to implement the Display trait
use std::fmt;
/// MetaCommand enumeration
#[derive(Debug, PartialEq)]
pub enum MetaCommand {
Exit,
Help,
Open,
}
/// Trait responsible for translating type into a formated text.
impl fmt::Display for MetaCommand {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Res... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[link(name = "windows")]
extern "system" {
#[cfg(feature = "Win32_Foundation")]
pub fn GetNetScheduleAccountInformation(pwszservername: super::super::Foundation::PWSTR, ccaccount: u32, wszaccount:... |
// Copyright 2020-2021, The Tremor 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 agr... |
use amethyst::{
ecs::prelude::{Entity, Join, Read, ReadExpect, ReadStorage, System, WriteStorage},
ui::UiText
};
use crate::components;
pub struct Hud {
pub entity: Entity
}
pub struct HudSystem;
impl<'s> System<'s> for HudSystem {
type SystemData = (
ReadStorage<'s, components::Player>,
... |
use std::{
collections::HashSet,
fmt::{Debug, Display},
};
use async_trait::async_trait;
use data_types::{CompactionLevel, ParquetFile, ParquetFileId};
pub mod logging;
/// Returns `true` if the files in the saved state have been changed according to the current state.
#[async_trait]
pub trait ChangedFilesFi... |
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::f64::consts::*;
#[allow(unused)]
const INF: usize = std::usize::MAX / 4;
#[allow(unused)]
const M: usize = 1000000007;
fn... |
//! # Ikon
//!
//! A robust, flexible framework for creating encoders and decoders for various
//! _icon formats_.
//!
//! # Overview
//!
//! **Ikon** is intended to be used as a framework for developers interested
//! in creating encoders and decoders for _various icon formats_ such as `.ico`
//! files ... |
#![crate_name = "simple_csv"]
#![cfg_attr(all(test, feature = "nightly"), feature(test))]
pub use reader::SimpleCsvReader;
pub use reader::SimpleCsvReaderOptions;
pub use writer::SimpleCsvWriter;
pub use writer::SimpleCsvWriterOptions;
pub use writer::NewlineType;
pub mod reader;
pub mod writer;
#[cfg(test)]
mod t... |
#![deny(improper_ctypes)]
use vector_wasm::{hostcall, Registration};
// This is **required**.
pub use vector_wasm::interop::*;
#[no_mangle]
pub extern "C" fn init() {
let _config = hostcall::config().unwrap();
Registration::transform().register().unwrap();
}
#[no_mangle]
pub extern "C" fn process(_data: u32,... |
#[cfg(any(target_os = "windows", target_os = "macos"))]
fn main() -> Result<(), Box<dyn std::error::Error>> {
fm_plugin::post_build::bundle_plugin()?;
Ok(())
}
|
use super::int::VarInt;
use crate::error::{custom_error, custom_io_error, ParseError};
use crate::prelude::*;
use nom::bytes::complete::take;
use nom::combinator::map;
use std::{borrow::Cow, convert::TryFrom};
impl WireFormatParse for Vec<u8> {
fn parse(input: &[u8]) -> nom::IResult<&[u8], Self, ParseError> {
... |
#[doc = "Reader of register UR11"]
pub type R = crate::R<u32, super::UR11>;
#[doc = "Reader of field `SA_END_2`"]
pub type SA_END_2_R = crate::R<u16, u16>;
#[doc = "Reader of field `IWDG1M`"]
pub type IWDG1M_R = crate::R<bool, bool>;
impl R {
#[doc = "Bits 0:11 - Secured area end address for bank 2"]
#[inline(a... |
#[doc = "Reader of register FPR1"]
pub type R = crate::R<u32, super::FPR1>;
#[doc = "Writer for register FPR1"]
pub type W = crate::W<u32, super::FPR1>;
#[doc = "Register FPR1 `reset()`'s with value 0"]
impl crate::ResetValue for super::FPR1 {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Typ... |
use libc;
extern "C" {
#[no_mangle]
fn __assert_rtn(
_: *const libc::c_char,
_: *const libc::c_char,
_: libc::c_int,
_: *const libc::c_char,
) -> !;
#[no_mangle]
fn memcpy(
__dst: *mut libc::c_void,
__src: *const libc::c_void,
__n: size_t,
... |
#![allow(warnings)]
mod app;
mod cmd;
mod config;
mod escape;
mod util;
fn main() -> anyhow::Result<()> {
env_logger::init();
let args = app::root().get_matches();
util::run_subcommand(&args, app::root, |cmd, args| match cmd {
"debug" => cmd::debug::run(args),
"find" => cmd::find::run(args... |
extern crate kaleidoscope;
use kaleidoscope::jit;
fn main() {
jit::run(0);
}
|
// Copyright 2021 Datafuse Labs.
//
// 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 ... |
extern crate rand;
mod optimal_sort_recursive;
mod optimal_sort;
mod optimal_sort_speedup;
use std::time::Instant;
fn main() {
let mut m: Vec<optimal_sort::Sorttype> = Vec::new();
for _ in 0..1<<20 {
m.push(rand::random());
}
let mut m_clone = m.clone();
let start_time = Instant::now();
let... |
mod instruction;
mod interpreter;
mod optimizer;
mod parser;
pub use interpreter::{Brainfuck, Error};
|
use std::collections::{HashMap, HashSet};
use collection::{Collection, Id, Idx};
pub type IdxSet<T> = HashSet<Idx<T>>;
pub struct OneToMany<T, U> {
one_to_many: HashMap<Idx<T>, IdxSet<U>>,
many_to_one: HashMap<Idx<U>, Idx<T>>,
}
impl<T, U> OneToMany<T, U>
where
T: Id<T>,
U: Id<U> + Id<T>,
{
pub f... |
struct kernel {
}
impl kernel {
} |
extern crate opemssh;
use std::env;
use std::fs::File;
use opemssh::{pem_to_der, der_to_openssh};
fn main() {
let filename = env::args().nth(1).expect("Give me a file");
let der = pem_to_der(&mut File::open(filename).unwrap()).unwrap();
// for c in der.as_slice() {
// print!("{:02x}", c.swap_byt... |
use super::super::gl;
use super::super::{configure_vertex_attributes_from_source, VertexFormat};
use std::fs;
use std::path::Path;
use math::{Mat4, Vec2, Vec3, Vec4};
use lazy_static::lazy_static;
use regex::Regex;
lazy_static! {
static ref EXTRACT_TEXTURE_UNIFORMS: Regex =
Regex::new(r"uniform\s+sampler2... |
use better_bae::TryFromAttributes;
use proc_macro2::TokenStream;
use syn::Token;
use crate::error::Error;
pub trait ProcMacro {
type Input;
fn new(input: Self::Input) -> Result<Self, Error>
where
Self: Sized;
fn expand(self) -> syn::Result<TokenStream>;
}
pub struct Field<Attr> {
pub at... |
extern crate futures;
mod support;
use futures::stream;
use support::*;
#[test]
fn unfold1() {
let mut stream = stream::unfold(0, |state| {
if state <= 2 {
let res: Result<_,()> = Ok((state * 2, state + 1));
Some(delay_future(res))
} else {
None
}
... |
pub mod serialized_type;
pub mod type_obj;
pub mod signed_obj;
|
mod error;
use crate::error::Error;
use async_trait::async_trait;
use handlebars::Handlebars;
use k8s_openapi::api::core::v1::{
ConfigMap, ConfigMapVolumeSource, Container, Node, Pod, PodSpec, Volume, VolumeMount,
};
use kube::api::ListParams;
use serde_json::json;
use tracing::{debug, info, trace, warn};
use s... |
use parser::ArgumentParser;
use super::{IncrBy,DecrBy};
use super::Store;
use test_parser::{check_ok};
fn incr_decr(args: &[&str]) -> f32 {
let mut val = 0f32;
{
let mut ap = ArgumentParser::new();
ap.refer(&mut val)
.add_option(&["-d", "--decr"], DecrBy(0.25f32),
"Decreme... |
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use glib;
use glib::object::Cast;
use glib::object::IsA;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
use glib::translate::*;
use glib::GString;
use glib::Static... |
use std::borrow::Cow;
use std::collections::BTreeMap;
use rustc_errors::DiagnosticBuilder;
use rustc_hir as hir;
use rustc_hir::intravisit::{walk_body, walk_expr, walk_inf, walk_ty, NestedVisitorMap, Visitor};
use rustc_hir::{Body, Expr, ExprKind, GenericArg, Item, ItemKind, QPath, TyKind};
use rustc_lint::{LateContex... |
// auto generated, do not modify.
// created: Mon Feb 22 23:57:02 2016
// src-file: /QtWidgets/qaccessiblewidget.h
// dst-file: /src/widgets/qaccessiblewidget.rs
//
// header block begin =>
#![feature(libc)]
#![feature(core)]
#![feature(collections)]
extern crate libc;
use self::libc::*;
// <= header block end
// m... |
#[path = "seq_trace_print_2/without_seq_trace.rs"]
mod without_seq_trace;
// TODO
// mod with_seq_trace;
|
use crate::{ResourceVersion, Tags, ViewPath};
use serde::{Deserialize, Serialize};
use smart_default::SmartDefault;
macro_rules! unidentified_resource {
($this_val:ident) => {
/// This is a bodge to handle the fact that we don't currently have support for
/// many of the Gms2 yy-files. Eventually, ... |
#[derive(Debug, Clone, Copy)]
pub enum GroupeVerbal {
EtreOuAvoir = 0,
PremierGroupe = 1,
DeuxiemeGroupe = 2,
TroisiemeGroupe = 3
}
#[derive(Debug, Clone, Copy)]
pub enum TypeDeVerbe {
Etre,
Avoir,
Autre
}
#[derive(Debug, Clone, Copy)]
pub enum VerbeIntransitif {
Intransitif,
... |
use approx;
use spatialos_sdk::worker::{entity::Entity, snapshot::*, EntityId};
use std::env;
use crate::generated::improbable::*;
use spatialos_sdk::worker::entity_builder::EntityBuilder;
#[test]
pub fn writing_invalid_entity_returns_error() {
let snapshot_path = env::temp_dir().join("test2.snapshot");
let ... |
use sqlparser::ast::{Expr as ASTNode, *};
use crate::error::{Result};
/// Responsible for parse each os the SQL Statements Components
pub fn parse_statement(statement: Statement) -> Result<Statement> {
unimplemented!();
} |
#[doc = r"Value read from the register"]
pub struct R {
bits: u32,
}
#[doc = r"Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::MTPR {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w... |
pub mod source;
pub mod transform;
pub mod sink; |
use super::*;
//
#[ test ]
#[ ignore ]
fn command_system_wipe_test()
{
println!( "wipe system" );
let mut system = System::new();
assert_eq!( system.wallets.len(), 1 );
system.wallet_create( &String::from( "user" ) );
assert_eq!( system.wallets.len(), 2 );
command_system_wipe( &mut system );
assert_eq!... |
pub fn verse(n: i32) -> String {
format!("{} of beer on the wall, {} of beer.\n{}, {} of beer on the wall.\n",
number_to_beers(n),
number_to_beers(n).to_lowercase(),
buy_or_grab(n-1),
number_to_beers(n-1).to_lowercase()
)
}
pub fn sing(start: i32, end: i32) -> String {
l... |
pub trait Voxel: Default + Copy + PartialEq + std::fmt::Debug {
fn is_empty(self) -> bool;
}
impl Voxel for u8 {
fn is_empty(self) -> bool {
self == 0
}
}
impl Voxel for u16 {
fn is_empty(self) -> bool {
self == 0
}
}
impl Voxel for u32 {
fn is_empty(self) -> bool {
se... |
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use std::str::FromStr;
#[derive(Debug, Clone, Copy)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum CompileMode {
Debug,
Release,
}
impl CompileMode {
pub fn is_release(&self) -> bool {
matches!(self, Self::Rele... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[cfg(feature = "Management_Deployment_Preview")]
pub mod Preview;
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core ::... |
use std::collections::HashSet;
use crate::Store;
/// Background of the scene.
///
/// It defines that happens to the ray is it hasn't hit any object in the scene.
pub trait Background: Store {
fn source(cache: &mut HashSet<u64>) -> String;
}
|
use clippy_utils::diagnostics::span_lint_and_help;
use clippy_utils::source::{snippet, snippet_with_applicability};
use clippy_utils::SpanlessHash;
use if_chain::if_chain;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::unhash::UnhashMap;
use rustc_errors::Applicability;
use rustc_hir::{def::Res, G... |
extern crate time_ as time;
use sqlx::MySql;
use sqlx_test::test_type;
test_type!(null(
MySql,
Option<i16>,
"NULL" == None::<i16>
));
test_type!(bool(MySql, bool, "false" == false, "true" == true));
test_type!(u8(MySql, u8, "CAST(253 AS UNSIGNED)" == 253_u8));
test_type!(i8(MySql, i8, "5" == 5_i8, "0" =... |
use std::{convert::TryFrom, sync::mpsc::RecvError, thread::JoinHandle};
use std::sync::{mpsc, Once};
use rusty_v8 as v8;
use crate::{function_parameter::FunctionParameter, V8HeapStatistics};
static INIT_PLATFORM: Once = Once::new();
fn init_platform() {
let platform = v8::new_default_platform(0, false).make_sh... |
use super::{Parameters, Raw};
use crate::parse::Node;
use std::fmt;
/// A value that can be manipulated.
/// These tend to be stored in Contexts.
/// They can enter programs from Literals embedded in the source, as the result of calculations,
/// and from being accessed from the standard library where any number of th... |
use crate::context::RpcContext;
use crate::felt::RpcFelt;
use crate::v02::types::request::BroadcastedInvokeTransaction;
use pathfinder_common::TransactionHash;
use starknet_gateway_client::GatewayApi;
use starknet_gateway_types::error::SequencerError;
#[derive(serde::Deserialize, Debug, PartialEq, Eq)]
#[serde(tag = "... |
#[doc = "Reader of register DIRTY"]
pub type R = crate::R<u8, super::DIRTY>;
#[doc = "Reader of field `dirty`"]
pub type DIRTY_R = crate::R<bool, bool>;
impl R {
#[doc = "Bit 0 - Set to ``1`` if this device was built from a git repo with uncommitted modifications."]
#[inline(always)]
pub fn dirty(&self) -> ... |
pub struct Solution;
impl Solution {
pub fn subsets(nums: Vec<i32>) -> Vec<Vec<i32>> {
let mut res = Vec::new();
rec(&mut Vec::new(), &nums, &mut res);
res
}
}
fn rec(head: &mut Vec<i32>, nums: &[i32], res: &mut Vec<Vec<i32>>) {
if nums.len() == 0 {
res.push(head.clone());
... |
#[doc = r"Value read from the register"]
pub struct R {
bits: u8,
}
#[doc = r"Value to write to the register"]
pub struct W {
bits: u8,
}
impl super::TXTYPE7 {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'... |
/*!
Native Windows GUI windowing base. Includes events dispatching and window creation.
Warning. Not for the faint of heart.
*/
use winapi::shared::minwindef::{BOOL, UINT, DWORD, HMODULE, WPARAM, LPARAM, LRESULT};
use winapi::shared::windef::{HWND, HMENU, HBRUSH};
use winapi::shared::basetsd::{DWORD_PTR, UINT_PTR};
us... |
use json_utils::json::JsValue;
use crate::core::fact::TypedFact;
use crate::json::JsPath;
use crate::prelude::*;
use super::IntoJsNumber;
use super::PredicateGT;
use super::PredicateGTE;
use super::PredicateLT;
use super::PredicateLTE;
pub fn eq<S: AsRef<str>, II: IntoIterator<Item = S>, N: IntoJsNumber>(
path: ... |
// SPDX-License-Identifier: Apache-2.0
#![deny(clippy::all)]
use serde::{Deserialize, Serialize};
use uuid::Uuid;
pub use koine::{Backend, Contract};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Keep {
pub uuid: Uuid,
pub contract: Contract,
}
|
use std::fs::File;
use std::io::Write;
use std::path::Path;
use image::{ImageBuffer, RgbaImage};
use crate::images::image::Image;
extern crate sheep;
pub struct SpriteSheet {
name: String,
pub buffer: RgbaImage,
pub meta: Option<sheep::SerializedSpriteSheet>,
}
impl SpriteSheet {
pub fn save<P>(
&self,
out... |
//! User-defined functions to serve as stand-ins when constructing the
//! projection expressions for the logical plan.
//!
//! As stand-ins, they allow the projection operator to represent the same
//! call information as the InfluxQL AST. These expressions are then
//! rewritten at a later stage of planning, with mor... |
use crate::sabi_types::{NulStr, NulStrError};
use abi_stable_shared::test_utils::must_panic;
use std::cmp::{Ord, Ordering, PartialOrd};
fn from_str_with_constructor(func: fn(&str) -> NulStr<'_>) {
let pairs = [("fob\0", "fob"), ("fo\0", "fo"), ("f\0", "f"), ("\0", "")];
for (strwn, str) in pairs.iter().copie... |
use crate::prelude::*;
use std::os::raw::c_void;
use std::ptr;
#[repr(C)]
#[derive(Debug)]
pub struct VkQueueFamilyProperties2KHR {
pub sType: VkStructureType,
pub pNext: *const c_void,
pub queueFamilyProperties: VkQueueFamilyProperties,
}
impl VkQueueFamilyProperties2KHR {
pub fn new(queue_family_pr... |
// Copyright (c) 2016 The vulkano developers
// 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. All files in the project carrying such
// notice may not be co... |
use super::Server;
use crate::config::TunCfg;
use crate::config::{LOCAL_SERVER, LOCAL_TPROXY_SERVER_PORT};
use crate::service::SubServiceCtlCmd;
use crate::service::TunMgrStub;
use failure::Error;
use log::{error, info};
use std::cell::RefCell;
use std::rc::Rc;
use std::result::Result;
type LongLive = Rc<RefCell<ReqMg... |
use std::str;
use std::rc::Rc;
use std::collections::HashMap;
#[derive(Debug)]
enum Inst
{
JumpIfFalse(usize),
Jump(usize),
Return,
Throw(),
Execute(),
PushInt(i64),
PushConst(Value),
PushLocal(usize),
PopLocal(usize),
CompareIntLess,
AddInt,
Concat,
InitFor(usize,SelectExp... |
// 表示编译成动态库
#![crate_type = "dylib"]
// 从其他语言调用 Rust 函数,下面的例子如果编译为动态库并从 C 语言中链接,call_from_c 函数就能够在 C 代码中访问
// no_mangle 告诉 Rust 编译器不要擅自改动这个函数的函数名
#[no_mangle]
pub extern "C" fn call_from_c() {
println!("Just called a Rust function from C!")
}
#[no_mangle]
pub extern "C" fn add_one(x: i32) -> i32 {
x + 1
}
|
use crate::algorithm::extremes::ExtremeIndices;
use crate::prelude::*;
use crate::{Line, Point, Polygon, Triangle};
use num_traits::float::FloatConst;
use num_traits::{Float, Signed};
// These are helper functions for the "fast path" of Polygon-Polygon distance
// They use the rotating calipers method to speed up calc... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[cfg(feature = "ApplicationModel_Contacts_DataProvider")]
pub mod DataProvider;
#[cfg(feature = "ApplicationModel_Contacts_Provider")]
pub mod Provider;
#[repr(transparent)]
#[derive(:: core... |
#[doc = "Reader of register DR"]
pub type R = crate::R<u32, super::DR>;
#[doc = "Reader of field `DATA`"]
pub type DATA_R = crate::R<u16, u16>;
#[doc = "Reader of field `ADC2DATA`"]
pub type ADC2DATA_R = crate::R<u16, u16>;
impl R {
#[doc = "Bits 0:15 - Regular data"]
#[inline(always)]
pub fn data(&self) ->... |
#[doc = "Reader of register DINR8"]
pub type R = crate::R<u32, super::DINR8>;
#[doc = "Reader of field `DIN8`"]
pub type DIN8_R = crate::R<u16, u16>;
impl R {
#[doc = "Bits 0:15 - Input data received from MDIO Master during write frames"]
#[inline(always)]
pub fn din8(&self) -> DIN8_R {
DIN8_R::new(... |
//pub(crate) mod troops;
//pub use self::troops::*;
use crate::space::Planet;
#[derive(Debug, Clone)]
#[allow(dead_code)]
pub enum Faction {
Rebels,
Imperials,
}
#[derive(Debug, Clone)]
#[allow(dead_code)]
pub enum Weapon {
Melee,
Ranged,
}
#[derive(Debug, Clone)]
#[allow(dead_code)]
pub struct Chara... |
use fyrox::{
core::{
algebra::{UnitQuaternion, Vector3},
pool::Handle,
},
engine::resource_manager::ResourceManager,
event::DeviceEvent,
resource::texture::TextureWrapMode,
scene::{
base::BaseBuilder,
camera::{CameraBuilder, SkyBox, SkyBoxBuilder},
graph::... |
//! Provides tools for manipulating shapes and relationships in the cartesian plane.
pub mod coord;
pub mod polygon;
pub mod segment;
pub mod orientation;
pub mod hull;
|
#[doc = "Reader of register CR2"]
pub type R = crate::R<u32, super::CR2>;
#[doc = "Writer for register CR2"]
pub type W = crate::W<u32, super::CR2>;
#[doc = "Register CR2 `reset()`'s with value 0"]
impl crate::ResetValue for super::CR2 {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
... |
#![recursion_limit="200"]
#![feature(plugin,range_contains,trace_macros)]
#![plugin(interpolate_idents)]
#![feature(field_init_shorthand)]
extern crate combine;
#[macro_use]
extern crate nom;
use std::borrow::Cow;
use std::cmp;
use std::env;
use std::fs::File;
use std::io::prelude::*;
use std::str;
use parser::MIFTr... |
use super::super::class::class::Class;
use super::super::class::classfile::constant::Constant;
use super::super::class::classfile::{method, method::MethodInfo};
use super::super::class::classheap::ClassHeap;
use super::super::gc::gc::GcType;
use super::cfg::CFGMaker;
use super::frame::{AType, Array, Frame, ObjectBody, ... |
use crate::Result;
use serde::{Deserialize, Serialize};
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
struct Response {
pub user: User,
}
/// User profile information.
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct User {
pub avatar_url: String,
pub aw... |
// Copyright 2020-2021, The Tremor 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 agr... |
use tikv::server::coprocessor::*;
use tikv::server::coprocessor;
use kvproto::kvrpcpb::Context;
use tikv::util::codec::{table, Datum, datum};
use tikv::util::codec::datum::DatumDecoder;
use tikv::util::codec::number::*;
use tikv::storage::{Dsn, Mutation, Key, DEFAULT_CFS};
use tikv::storage::engine::{self, Engine, TEMP... |
extern crate rustplot;
use rustplot::chart_builder;
use rustplot::chart_builder::Chart;
use rustplot::data_parser;
#[test]
fn doughnut_chart_tests() {
let data_1 = data_parser::get_str_col(0, 0, 5, "./resources/doughnut_chart_tests.csv");
let data_2 = data_parser::get_num_col(1, 0, 5, "./resources/doughnut_ch... |
// Copyright (c) 2016 The Rouille developers
// 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. All files in the project carrying such
// notice may not be co... |
use eosio::{AccountName, ActionName, Name};
use structopt::StructOpt;
/// Multisig contract commands
#[derive(StructOpt, Debug)]
pub enum Multisig {
/// Propose action
Propose(Propose),
/// Propose transaction
ProposeTrx(ProposeTrx),
/// Review transaction
Review(Review),
/// Approve propos... |
//! Unwind information for x64 Windows.
use super::registers::RU;
use crate::binemit::FrameUnwindSink;
use crate::ir::{Function, InstructionData, Opcode};
use crate::isa::{CallConv, RegUnit, TargetIsa};
use alloc::vec::Vec;
use byteorder::{ByteOrder, LittleEndian};
/// Maximum (inclusive) size of a "small" stack allo... |
#[rustfmt::skip]
pub mod google;
|
use failure::{bail, ensure, Error};
use ocl;
use std::marker::PhantomData;
use std::ops::{Deref, DerefMut};
use std::result;
use crate::command;
use crate::cvar::{cvar_t, CVar};
use crate::hooks::hw;
use crate::utils::MaybeUnavailable;
type Result<T> = result::Result<T, Error>;
static mut MAIN_THREAD_DATA: MainThrea... |
pub mod libdna_ffi; // "import" libdnaffi
pub mod native;
fn main() {
use crate::libdna_ffi::dna;
println!("{:?}", dna::version());
let forward = String::from("AACTAATT");
let backward = native::revcomp(&forward);
println!("{:?}", forward);
println!("{:?}", backward);
let backward = dna::r... |
use P28::lsort;
pub fn main() {
let li = vec![
vec!['a', 'b', 'c'],
vec!['d', 'e'],
vec!['f', 'g', 'h'],
vec!['d', 'e'],
vec!['i', 'j', 'k', 'l'],
vec!['m', 'n'],
vec!['o'],
];
println!("sorted={:?}", lsort(&li));
}
|
#[path = "./testfns.rs"]
mod testfns;
use std::env;
use std::path::PathBuf;
use std::fs::File;
use std::io::Read;
use testfns::*;
#[test]
fn test_dummy_project_can_be_setup() {
return (); // FIXME the test is shaky and fails from time to time
let actualdest: PathBuf = PathBuf::from(
env::current_dir(... |
use crate::resource::UiThemed;
use core::{
assets::protocol::{AssetLoadResult, AssetProtocol},
Ignite,
};
use serde::{Deserialize, Serialize};
use std::{collections::HashMap, str::from_utf8};
#[derive(Ignite, Debug, Default, Clone, Serialize, Deserialize)]
pub struct UiThemeAsset(HashMap<String, UiThemed>);
i... |
// 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 serde::{Serialize, Serializer};
use serde_derive::{Deserialize, Serialize};
use std::collections::HashMap;
/// Result from each test step. Usually eac... |
pub struct Solution;
#[derive(PartialEq, Eq, Clone, Debug)]
pub struct ListNode {
pub val: i32,
pub next: List,
}
type List = Option<Box<ListNode>>;
impl Solution {
pub fn remove_nth_from_end(head: List, n: i32) -> List {
let mut head = head;
let mut length = 0;
let mut current = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.