text stringlengths 8 4.13M |
|---|
extern crate sigar_rs;
use sigar_rs::{net, strip_bytes};
use std::str;
fn main() {
let ifaces = net::interface_list().unwrap();
println!("{:?} interfaces:", ifaces.len());
for cs in ifaces {
println!("\t{:?}", cs.into_string().unwrap());
}
let interface = net::interface_config_primary().u... |
use matcher::MatchScope;
use serde::{Deserialize, Serialize};
use std::borrow::Cow;
use types::{ClapItem, FuzzyText};
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
pub struct ProjectTag {
name: String,
path: String,
pattern: String,
line: usize,
kind: String,
}
impl ProjectTag {
/// ... |
//! A driver concretely executes a Falcon IL programs.
use crate::architecture::Architecture;
use crate::executor::successor::*;
use crate::executor::State;
use crate::il;
use crate::Error;
use crate::RC;
/// A driver for a concrete executor over Falcon IL.
#[derive(Debug, Clone)]
pub struct Driver {
program: RC<... |
// auto generated, do not modify.
// created: Mon Feb 22 23:57:02 2016
// src-file: /QtGui/qmatrix.h
// dst-file: /src/gui/qmatrix.rs
//
// header block begin =>
#![feature(libc)]
#![feature(core)]
#![feature(collections)]
extern crate libc;
use self::libc::*;
// <= header block end
// main block begin =>
// <= mai... |
#[cfg(feature = "Win32_Web_InternetExplorer")]
pub mod InternetExplorer;
|
use super::*;
#[derive(Clone)]
pub struct InterfaceImpl(pub Row);
impl InterfaceImpl {
pub fn interface(&self) -> TypeDefOrRef {
self.0.decode(1)
}
fn attributes(&self) -> impl Iterator<Item = Attribute> {
self.0.file.attributes(HasAttribute::InterfaceImpl(self.clone()))
}
fn has... |
//! This module holds the definitions of
//! JYInfo related wrappers.
use data_structs::JYInfo;
use jalali_bindings::*;
impl JYInfo {
/// This function initializes the struct.
///
/// # Examples
///
/// ```
/// extern crate jalali;
///
/// jalali::JYInfo::new();
///
/// ```
pub fn new() -> Self ... |
use super::{input::Input, status::Status};
use crate::cpu::CPU;
use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
use std::io::Stdout;
use tui::{
backend::CrosstermBackend,
layout::{Constraint, Direction, Layout, Rect},
style::{Color, Style},
Frame,
};
pub enum KeyAction {
Nothing,
... |
// 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... |
extern crate engine;
use std::collections::linked_list::LinkedList;
use std::collections::HashMap;
use std::rc::Rc;
use std::sync::Arc;
use criterion::{black_box, criterion_group, criterion_main, BatchSize, Criterion};
use rand::Rng;
use engine::algos::book::*;
use engine::algos::*;
fn fill_order_book(mut book: &mu... |
use rocket::Route;
mod up;
pub fn routes() -> Vec<Route> {
routes![up::site_po]
}
|
extern crate glob;
extern crate serde;
extern crate chrono;
#[macro_use]
extern crate serde_derive;
use glob::glob;
use pulldown_cmark::{html, Parser};
use std::fs;
use std::fs::File;
use std::io::prelude::*;
use std::io::{BufReader, Result, SeekFrom};
use std::path::Path;
use tera::{Context, Tera};
use chrono::prelu... |
#![cfg(target_arch = "x86_64")]
use std::arch::x86_64::*;
use crate::detail::sse::{rcp_nr1};
pub type Element = __m128;
/// A point is represented as the multivector
/// $x\mathbf{e}_{032} + y\mathbf{e}_{013} + z\mathbf{e}_{021} +
/// \mathbf{e}_{123}$. The point has a trivector representation because it is
/// the ... |
#[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::SHAMD5_DMARIS {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnc... |
// 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.
#[cfg(test)]
use {
crate::create_fidl_service,
crate::registry::device_storage::testing::*,
crate::registry::service_context::ServiceContext,
... |
table! {
entries (id) {
id -> Int4,
opt -> Nullable<Text>,
num -> Timestamp,
hash -> Text,
}
}
|
// 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 agre... |
mod handler;
mod input;
mod job;
mod plugin;
mod provider;
mod service;
mod vim;
pub use self::input::InputHistory;
use self::input::{ActionEvent, Event, ProviderEvent};
use self::plugin::{
ActionType, ClapPlugin, CtagsPlugin, CursorWordHighlighter, GitPlugin, MarkdownPlugin,
PluginId, SystemPlugin,
};
use sel... |
use crate::librb::size_t;
use libc;
use libc::close;
use libc::free;
#[repr(C)]
#[derive(Copy, Clone)]
pub struct volume_id {
pub fd: libc::c_int,
pub error: libc::c_int,
pub sbbuf_len: size_t,
pub seekbuf_len: size_t,
pub sbbuf: *mut u8,
pub seekbuf: *mut u8,
pub seekbuf_off: u64,
pub label: [libc::c_... |
use crate::smb2::requests::close::Close;
/// Serializes the create request body.
pub fn serialize_close_request_body(request: &Close) -> Vec<u8> {
let mut serialized_request: Vec<u8> = Vec::new();
serialized_request.append(&mut request.structure_size.clone());
serialized_request.append(&mut request.flags.... |
pub struct BitField{
inner: Vec<u8>,
size: usize,
}
impl BitField {
pub fn new(size) -> BitField {
BitField {
inner: vec![0; (size + 7) / 8],
size
}
}
pub get_first_unset_from(idx: usize) -> usize {
let start = idx / 8;
let offset = idx % 8;... |
/*
* Copyright 2020 Draphar
*
* 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 writi... |
use crate::vec3::*;
pub struct Ray {
pub origin: Vec3,
pub direction: Vec3,
}
impl Ray {
pub fn new() -> Self {
Ray {
origin: Vec3::new(),
direction: Vec3::new()
}
}
pub fn point_at_parameter(&self, t: f32) -> Vec3 {
// LERP from origin
self.origin + t * self.direction
}
}
//... |
use std::{
thread,
time::{Duration, Instant},
};
pub struct Time {
start: Instant,
frame_count: u32,
fps: u32,
}
impl Time {
pub fn new(fps: u32) -> Self {
Self {
start: Instant::now(),
frame_count: 0,
fps,
}
}
/// restarts this time... |
use std::{
path::{Path, PathBuf},
sync::Arc,
};
use async_recursion::async_recursion;
use futures::TryStreamExt;
use log::{error, info, trace, LevelFilter};
use structopt::StructOpt;
use tokio::{
fs::{read_dir, DirEntry},
spawn,
sync::{
mpsc::{self, Sender},
Mutex, Semaphore,
},... |
use crate::context::{Context, Output, Printer};
use crate::descriptor::{EnumDescriptor, FileDescriptor, MessageDescriptor};
use crate::pecan_descriptor::google::protobuf::descriptor_pb::*;
use id_arena::Id;
use pecan::Message;
use pecan::Result;
use pecan_utils::naming;
use std::env;
use std::fmt::Write;
use std::colle... |
// Copyright 2022 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 ... |
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
failure::Fail,
fuchsia_syslog::{fx_log_err, fx_log_info},
serde_derive::Deserialize,
std::{
fs::File,
io::{BufReader,... |
use super::*;
use std::cmp::{Eq, Ord, Ordering, PartialEq, PartialOrd};
use std::ffi::{CString, OsStr};
use std::fmt;
use std::mem::ManuallyDrop;
use widestring::U16CString;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct fmx_Text {
_address: u8,
}
#[cfg_attr(target_os = "macos", link(kind = "framework", name... |
extern crate openssl;
use openssl::symm::{encrypt, Cipher, Crypter,decrypt, Mode};
use std::io::prelude::*;
use std::fs::File;
//iphertext: [32, 136, 124, 97, 212, 176, 15, 167, 9, 112, 240, 103, 131, 31, 215, 153,|| 253, 26, 84, 75, 222, 71, 255, 255, 66, 49, 153, 18, 25, 115, 185, 62,||| 36, 162, 83, 129, 135, 172, ... |
use slog;
use std;
use r2d2;
use r2d2_postgres::{PostgresConnectionManager, TlsMode};
use r2d2::Pool;
use iron::typemap::Key;
use config;
pub struct DalPostgresPool {
pub rw_pool: Pool<PostgresConnectionManager>,
pub ro_pool: Option<Pool<PostgresConnectionManager>>,
}
impl DalPostgresPool {
pub fn get_p... |
use clippy_utils::diagnostics::span_lint_and_sugg;
use clippy_utils::is_lint_allowed;
use clippy_utils::source::snippet;
use rustc_ast::ast::LitKind;
use rustc_errors::Applicability;
use rustc_hir::{Expr, ExprKind, HirId};
use rustc_lint::{LateContext, LateLintPass};
use rustc_session::{declare_lint_pass, declare_tool_... |
use crate::db::DriverType;
///the stmt replace str convert
pub trait StmtConvert {
fn stmt_convert(&self, index: usize) -> String;
}
impl StmtConvert for DriverType {
fn stmt_convert(&self, index: usize) -> String {
match &self {
DriverType::Postgres => {
format!(" ${} ", i... |
//! PE Linker/Loader
use crate::architecture::{Amd64, Mips, X86};
use crate::loader::*;
use crate::memory::backing::Memory;
use crate::memory::MemoryPermissions;
use std::fs::File;
use std::io::Read;
use std::path::Path;
/// Loader for a single PE file.
#[derive(Debug)]
pub struct Pe {
bytes: Vec<u8>,
archite... |
//! [rocket_governor_derive](crate) was part of a [rocket] guard implementation of the
//! [governor] rate limiter.
//!
//! It got replaced completely by only [rocket_governor].
//!
//! [governor]: https://docs.rs/governor
//! [rocket]: https://docs.rs/rocket/
//! [rocket_governor]: https://docs.rs/rocket_governor/
... |
fn read_line() -> String {
let mut buf = String::new();
std::io::stdin().read_line(&mut buf).expect("failed to readline");
buf
}
fn create_num_vec() -> Vec<i64> {
let buf = read_line();
let iter = buf.split_whitespace().map(|x| x.parse().expect("unable to parse"));
let num_vec : Vec<i64> = it... |
// Copyright 2022 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 ... |
use regex::Regex;
use unidecode::unidecode;
fn remove_tokens<'a>(s: &str) -> String {
let corp_toks = Regex::new(r"\b(llc|inc|ltd|pte|intl|gmbh|corp|domaine|chateau|corporation|company|co|sa|sl|winery|wines|bodega|slu|vineyard|winework|cellar|the)\b").unwrap();
let rm_ch = Regex::new(r"\bch\b").unwrap().repla... |
use crate::mechanics::attack::Attack;
use crate::mechanics::damage::Damage;
pub trait ReceiveDamage {
fn calculate_inflicted_damage(&self, incoming_attack: Attack) -> Damage;
}
|
use crate::{
extensions::ResolveInfo, parser::types::Field, ContextSelectionSet, OutputType, Positioned,
ServerResult, Value,
};
/// Resolve an list by executing each of the items concurrently.
pub async fn resolve_list<'a, T: OutputType + 'a>(
ctx: &ContextSelectionSet<'a>,
field: &Positioned<Field>,
... |
use crate::error::Error;
use crate::resolve_import::resolve_import;
use std::sync::Arc;
use std::sync::Mutex;
use swc_common::comments::SingleThreadedComments;
use swc_common::errors::Diagnostic;
use swc_common::errors::DiagnosticBuilder;
use swc_common::errors::Emitter;
use swc_common::errors::Handler;
use swc_common:... |
use efm32gg_hal::gpio;
use embedded_hal::digital::OutputPin;
use efm32gg_hal::gpio::EFM32Pin;
/// A representation of the two user LEDs on the STK3700
pub struct LEDs {
led0: gpio::pins::PE2<gpio::Output>,
led1: gpio::pins::PE3<gpio::Output>,
}
impl LEDs {
pub fn new(pe2: gpio::pins::PE2<gpio::Disabled>, ... |
use std::fs::File;
use std::io::BufReader;
use std::io::Read;
use std::fmt;
use std::env;
use std::collections::HashSet;
use std::collections::HashMap;
use std::cmp::Ordering;
#[derive(Copy, Clone)]
enum Direction {
North, South, East, West
}
#[derive(Copy, Clone)]
enum Turn {
Left, Straight, Right
}
#[deriv... |
use super::*;
#[test]
fn without_registered_returns_empty_list() {
with_process_arc(|unregistered_process_arc| {
assert_eq!(
result(
&unregistered_process_arc,
unregistered_process_arc.pid_term(),
item()
),
Ok(Term::NIL)
... |
#[doc = "Reader of register EXTICR4"]
pub type R = crate::R<u32, super::EXTICR4>;
#[doc = "Writer for register EXTICR4"]
pub type W = crate::W<u32, super::EXTICR4>;
#[doc = "Register EXTICR4 `reset()`'s with value 0"]
impl crate::ResetValue for super::EXTICR4 {
type Type = u32;
#[inline(always)]
fn reset_va... |
use std::collections::HashMap;
use id::Id;
use timestamp::Timestamp;
/// Temporary structure to encode object details.
///
/// I'm still thinking about how objects should be structured, but I want to
/// tinker with other pieces of the codebase.
#[derive(Debug, Clone)]
pub enum ObjectDetails {
Forest {
//... |
use futures::stream::StreamExt;
use rtnetlink::{
new_connection,
packet::{rtnl::link::nlas::Nla, LinkMessage, NetlinkPayload, RtnlMessage, RtnlMessage::*},
sys::{constants::*, SocketAddr},
};
use zoomies::{Client, ConfigBuilder, Event};
#[tokio::main(max_threads = 1, core_threads = 1)]
async fn main() ->... |
//! Query planner wrapper for use in IOx services
use std::sync::Arc;
use bytes::Bytes;
use datafusion::{
arrow::datatypes::SchemaRef, error::DataFusionError, physical_plan::ExecutionPlan,
};
use flightsql::{FlightSQLCommand, FlightSQLPlanner};
use iox_query::{
exec::IOxSessionContext,
frontend::sql::SqlQu... |
// Copyright 2023 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 ... |
use actix_web::actix::{Actor, Addr, SyncArbiter, SyncContext};
use actix_web::{actix::Handler, actix::Message, Error};
use futures::Future;
use juniper::http::GraphQLRequest;
use crate::model::db::Database;
use crate::model::user::UserById;
use crate::share::common::Claims;
use crate::share::gql_schema::{create_schema... |
#![allow(non_snake_case)]
extern crate regex;
extern crate winit;
use regex::Regex;
mod stuff;
fn showGui()
{
let mut events_loop = winit::EventsLoop::new();
let window = winit::Window::new(&events_loop).unwrap();
events_loop.run_forever(|event| {
match event {
winit::Event::WindowEv... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct CurrentSessionChangedEventArgs(pub ::windows::... |
//! Implements [`SequentialSpec`] for [`Register`] operational semantics.
use super::SequentialSpec;
use std::fmt::Debug;
/// A simple register used to define reference operational semantics via
/// [`SequentialSpec`].
#[derive(Clone, Default, Debug, Hash, PartialEq, serde::Serialize)]
pub struct Register<T>(pub T);
... |
use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign};
use num_traits::Zero;
use std::convert::From;
#[repr(transparent)]
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Voxel {
iso_value: f32,
}
impl Voxel {
pub fn new(value: f32) -> Voxel {
Voxel {
iso_value:... |
//! An example of a multisig to execute arbitrary Solana transactions.
//!
//! This program can be used to allow a multisig to govern anything a regular
//! Pubkey can govern. One can use the multisig as a BPF program upgrade
//! authority, a mint authority, etc.
//!
//! To use, one must first create a `Multisig` accou... |
use super::super::super::exec::frame::ObjectBody;
use super::super::super::gc::gc::GcType;
#[derive(Debug, Clone)]
pub enum ConstantType {
Class,
Fieldref,
Methodref,
InterfaceMethodref,
String,
Integer,
Float,
Long,
Double,
NameAndType,
Utf8,
MethodHandle,
MethodTyp... |
#[derive(Clone, Debug)]
pub struct Error {
inner: String,
backtrace: Option<Backtrace>,
}
impl Error {
pub fn new(inner: impl std::fmt::Display) -> Self {
Self::with_string(inner.to_string())
}
fn with_string(inner: String) -> Self {
Self {
inner,
backtrace:... |
// 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 ... |
// Copyright 2022 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 ... |
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from ../gir-files
// DO NOT EDIT
use crate::Session;
use glib::object::IsA;
use glib::translate::*;
use std::fmt;
glib::wrapper! {
#[doc(alias = "SoupSessionFeature")]
pub struct SessionFeature(Interface<ffi::SoupSessionFeature, ffi::SoupSes... |
use crate::mq;
use log::{Level, Metadata, Record};
use std::sync::{Arc, RwLock};
type Log = Arc<RwLock<Vec<(Level, f64, String)>>>;
static mut LOG: Option<Log> = None;
pub struct Logger;
static LOGGER: Logger = Logger;
static mut INNER: Option<env_logger::Logger> = None;
impl Logger {
pub fn init() {
un... |
// Copyright 2019, 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
// disclai... |
use std::collections::hash_map::{HashMap, Entry};
use std::io;
use std::mem;
use std::os::windows::prelude::*;
use std::sync::{Arc, Mutex};
use slab::Index;
use winapi::*;
use wio::Overlapped;
use wio::iocp::{CompletionPort, CompletionStatus};
use {Token, PollOpt};
use event::{IoEvent, EventSet};
/// The guts of the... |
use model::controll::{ClientControll, ServerControll};
use model::session::Session;
use tokio::prelude::*;
use util::futu::*;
pub trait IntoMachine
where
Self: Sized,
{
fn machine(self, name: String) -> Machine<Self> {
Machine::new(self, name)
}
}
impl<S> IntoMachine for S
where
S: Stream,
{
}... |
// PartialOrd is for the exercise.
// Copy is for the list values function.
//
pub struct LinkedList<T: PartialOrd + Copy>(Option<(T, Box<LinkedList<T>>)>);
impl<T: PartialOrd + Copy> LinkedList<T> {
pub fn new() -> LinkedList<T> {
LinkedList(None)
}
pub fn push_front(&mut self, data: T) {
... |
use crate::render::{DrawCtx, DrawTurn};
use ezgui::{
Color, EventCtx, GeomBatch, GfxCtx, Line, ModalMenu, ScreenDims, ScreenPt, Scroller, Text,
};
use geom::{Circle, Distance, Duration, PolyLine, Polygon, Pt2D};
use map_model::{Cycle, IntersectionID, Map, TurnPriority, TurnType, LANE_THICKNESS};
use ordered_float::... |
use ::glutin_window::{GlutinWindow};
use ::conrod;
use ::opengl_graphics::glyph_cache::GlyphCache;
use ::opengl_graphics::{OpenGL, GlGraphics};
use ::sheet::{Coord, Value, Formula};
use ::std::sync::mpsc::{sync_channel, Receiver, SyncSender};
use ::std::sync::Mutex;
const WINDOW_WIDTH: u32 = 800;
const WINDOW_HEIGHT: ... |
#![doc = include_str!("multi_view_open_exr.md")]
|
/// Parts contained within an Envelope. This is used to tell if an encrypted
/// message was successfully decrypted, by decrypting the envelope body and checking
/// if deserialization succeeds.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EnvelopeBody {
#[prost(bytes, repeated, tag = "1")]
pub part... |
pub mod force;
pub mod grouping;
use crate::force::group_many_body_force::GroupManyBodyForceArgument;
use petgraph::graph::{Graph, IndexType, NodeIndex};
use petgraph::EdgeType;
use petgraph_layout_force::link_force::LinkArgument;
use petgraph_layout_force_simulation::{Force, Point};
use std::collections::HashMap;
pu... |
mod upc;
fn main() {
let input = std::env::args().nth(1).expect("arg1 should be the UPC to calculate the check digit for");
println!("{}", upc::calc_check_digit(&input));
}
#[cfg(test)]
mod tests {
use super::upc::calc_check_digit;
#[test]
fn test_upc() {
assert_eq!(calc_check_digit("4210... |
// 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::{
buffer_writer::{BufferWriter, ByteSliceMut, LayoutVerified},
mac::{
self, Addr4, DataHdr, FrameControl, HtCo... |
#[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::_3_FLTSEN {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R... |
//! **S**tructured **r**epresentation of various SPIR-V language constructs.
pub use self::autogen_decoration::Decoration;
pub use self::autogen_instructions as instructions;
pub use self::autogen_ops as ops;
pub use self::constants::Constant;
pub use self::types::{StructMember, Type};
mod autogen_decoration;
pub mod... |
use std::collections::HashSet;
use chrono::offset::{FixedOffset, TimeZone};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use cosmwasm_std::{Addr, Api, Coin, Uint128};
use cw0::Expiration;
use crate::cron::CronCompiled;
use crate::error::ContractError;
const MAX_DESCRIPTION_LENGTH: usize = 5000;
co... |
use super::period::Period;
#[derive(Debug, Clone)]
pub struct TaskData {
pub name: String,
pub count: i32,
pub period: Period,
}
|
//! ttyecho is a crate that lets you write data into a Linux kernel pseudoterminal buffer.
//! This crate will not work on a non-Linux platform.
//!
//! # Example
//!
//! ```rust
//! fn main() {
//! // You can put whatever you want, not only commands.
//! let command = "echo ttyecho!";
//! // Target tty
... |
pub use VkSubpassContents::*;
#[repr(u32)]
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum VkSubpassContents {
VK_SUBPASS_CONTENTS_INLINE = 0,
VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS = 1,
}
|
use crate::{
ast::{self, AstNode},
T,
};
use crate::{SmolStr, SyntaxNode};
impl ast::Name {
pub fn text(&self) -> &SmolStr {
text_of_first_token(self.syntax())
}
}
impl ast::NameRef {
pub fn text(&self) -> &SmolStr {
text_of_first_token(self.syntax())
}
}
fn text_of_first_toke... |
// https://www.reddit.com/r/rust/comments/d5i74n/accessing_zipped_file/
use std::fs::File;
// use std::fs;
fn doit() -> zip::result::ZipResult<()> {
use std::io::prelude::*;
let mut f = File::open("download.zip")?;
let mut zip = zip::ZipArchive::new(f)?;
for i in 0..zip.len()
... |
// Name: Farhan Sami
// RSN: 500892031
pub fn deal(cards:[u32;10]) -> [String;5] {
let mut hand1:[u32;5] = [cards[0],cards[2],cards[4],cards[6],cards[8]];
let mut hand2:[u32;5] = [cards[1],cards[3],cards[5],cards[7],cards[9]];
hand1.sort();
hand1.reverse();
hand2.sort();
hand2.rever... |
use std::ffi::c_void;
use std::fmt::{self, Display};
use std::iter::FusedIterator;
use crate::support::{self, LogicalResult, MlirStringCallback, StringRef};
use crate::{Context, SymbolTable, Visibility};
use super::*;
extern "C" {
pub(crate) type MlirOperation;
}
/// Indicates that an API was given/returned an ... |
use mysql::chrono::*;
pub trait LladreDAO {
fn obtenir_denuncies(&self) -> Vec<Denuncia>;
fn obtenir_visites(&self, museu_id: u32, hora: DateTime<Utc>) -> Vec<Visitant>;
}
#[derive(Debug, PartialEq, Eq)]
pub struct Denuncia {
pub museu_id: u32,
pub museu_nom: String,
pub hora: DateTime<Utc>,
}
#[... |
use std::sync::Arc;
use datafusion::{execution::context::SessionState, physical_optimizer::PhysicalOptimizerRule};
use self::{
combine_chunks::CombineChunks,
dedup::{
dedup_null_columns::DedupNullColumns, dedup_sort_order::DedupSortOrder,
partition_split::PartitionSplit, remove_dedup::RemoveDe... |
//! An `Operation` captures the semantics of the IL.
use crate::il::*;
use serde::{Deserialize, Serialize};
use std::fmt;
/// An IL Operation updates some state.
#[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub enum Operation {
/// Assign the value given in expression to t... |
use std::collections::HashSet;
use darling::{util::SpannedValue, FromMeta};
use proc_macro2::{Span, TokenStream, TokenTree};
use proc_macro_crate::{crate_name, FoundCrate};
use quote::quote;
use syn::{
visit::Visit, visit_mut, visit_mut::VisitMut, Attribute, Error, Expr, ExprPath, FnArg, Ident,
ImplItemMethod,... |
use crate::{
sdk::export::{
trace::{ExportResult, SpanData, SpanExporter},
ExportError,
},
sdk::{
trace::{Config, EvictedHashMap, EvictedQueue},
InstrumentationLibrary,
},
trace::{Span, SpanContext, SpanId, SpanKind, StatusCode},
KeyValue,
};
use async_trait::asyn... |
use super::LED;
use core::future::Future;
use drogue_device::{
actors::{button::*, led::*},
kernel::actor::*,
};
#[derive(Debug)]
pub enum Command {
Toggle,
}
pub struct App {
address: Option<Address<'static, App>>,
led1: Option<Address<'static, Led<LED>>>,
led2: Option<Address<'static, Led<LE... |
use std::cell::RefCell;
use std::rc::Rc;
use input::Input;
use parser::evaluator::TagEvaluator;
use sensor::evaluator::NamedSensors;
use input::cutoff::EvalCutoff;
use input::maximum::EvalMaximum;
use input::panic::EvalPanic;
use input::sensor::EvalSensorInput;
use input::smooth::EvalSmooth;
use input::step::EvalStep... |
pub use crate::ccu::CcuExt as _pine64_hal_ccu_CcuExt;
pub use crate::dma::DmaExt as _pine64_hal_dma_DmaExt;
pub use crate::gpio::GpioExt as _pine64_hal_gpio_GpioExt;
pub use crate::hal::digital::v2::InputPin as _embedded_hal_digital_InputPin;
pub use crate::hal::digital::v2::OutputPin as _embedded_hal_digital_OutputPin... |
extern crate iostream;
use iostream::io::*;
use std::io::Write;
use std::fs::remove_file;
fn make_file()
{
let mut file = FileStream::new("1.data", FileMode::CreateNew, FileAccess::Write).expect("not make 1.data");
let data: [u8; 1024] = [1; 1024];
file.file.write_all(&data).expect("not write data to 1.d... |
use crate::byte::{ByteChar, ByteString};
use std::fmt::{self, Debug, Display, Formatter};
use std::ops::{Deref, DerefMut};
/// A single-byte string slice.
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(transparent)]
pub struct ByteStr([ByteChar]);
macro_rules! cast {
(mut $x:expr, $($T:ty)=>*) => {
uns... |
// `without_arity_errors_badarity` in unit tests
test_stdout!(with_arity_returns_function_return, "from_fun\n");
|
use crate::G;
use wizardscastle::armor::ArmorType;
use wizardscastle::game::Stairs;
use wizardscastle::monster::MonsterType;
use wizardscastle::player::{Gender, Race, Stat};
use wizardscastle::room::RoomType;
use wizardscastle::treasure::TreasureType;
use wizardscastle::weapon::WeaponType;
use rand::Rng;
impl G {
... |
//! Defines the basic types to do crypto, committees and hold basic information.
use std::borrow::Borrow;
use std::collections::HashMap;
use std::convert::TryInto;
use std::iter::FromIterator;
use sha2::{Digest, Sha512};
use serde::{Deserialize, Serialize};
use crate::crypto::{PublicKey, SecretKey, Signature};
use ... |
use super::{NSComparisonResult, NSString};
use crate::objc::{Class, NSInteger, NSObject, NSUInteger, Object, BOOL};
use std::{
cmp::Ordering,
ffi::CStr,
fmt,
ops::Deref,
os::raw::{
c_char, c_double, c_float, c_int, c_long, c_longlong, c_short, c_uchar, c_uint, c_ulong,
c_ulonglong, c... |
mod ast;
mod codegen;
mod lexer;
mod parser;
mod semantic;
use codegen::CodeGeneratable;
use codespan_reporting::files::SimpleFiles;
use codespan_reporting::term;
use codespan_reporting::term::termcolor::{ColorChoice, StandardStream};
use lexer::Lexer;
use parser::parse;
use semantic::TypeCheckable;
// use std::collec... |
pub struct Solution;
pub struct TreeNode {
pub val: i32,
pub left: Tree,
pub right: Tree,
}
use std::cell::RefCell;
use std::rc::Rc;
type Tree = Option<Rc<RefCell<TreeNode>>>;
impl Solution {
pub fn sum_numbers(root: Tree) -> i32 {
match root {
None => 0,
Some(node) =... |
pub mod audio;
pub mod error;
pub mod fs;
pub mod graphics;
pub mod input;
pub mod math;
mod context;
use std::future::Future;
pub use self::{context::*, error::EngineError};
pub mod log {
pub use macroquad::miniquad::{debug, error, info, log::Level, trace, warn};
}
pub mod utils {
pub use macroquad::prel... |
#![feature(external_doc)]
#![doc(include = "../README.md")]
pub mod ast;
pub mod interpreter;
pub mod lexer;
pub mod parser;
pub mod prelude;
pub mod token;
use std::fmt;
/// The type of an identifier in `tini`.
pub type Identifier = String;
/// A position in a file, consisting of a line number and a column number.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.