text stringlengths 3.09k 13.9k |
|---|
extern crate dirs;
extern crate inflector;
use inflector::Inflector;
use std::io::{Write, Read};
use std::process::{Command, Stdio};
use std::fs;
use std::path;
fn get_emsdk(siyo_dir: &path::PathBuf) -> path::PathBuf {
let mut emsdk_dir = siyo_dir.clone();
emsdk_dir.push("emsdk-master");
if emsdk_dir.exi... |
use super::InputBuffer;
use ::libs::crossbeam::channel::{unbounded, Receiver, Sender};
use std::sync::Arc;
const CMPL_ITEMS_LIM: usize = 10;
pub trait Completer: Send {
fn complete(&self, input: &str, cursor_pos: usize, word_pos: usize) -> Vec<Completion>;
}
pub struct Completions {
// engine
changeset: ... |
use super::*;
use crate::datastr::graph::time_dependent::period as int_period;
use crate::datastr::graph::Graph as GraphTrait;
type IPPIndex = u32;
/// First out based graph data structure for time-dependent graphs.
/// All data is owned.
#[derive(Debug, Clone)]
pub struct Graph {
first_out: Vec<EdgeId>,
head... |
use std::{error, fmt};
use std::net::SocketAddr;
use std::time::Duration;
use std::sync::Arc;
use http;
use futures::{Async, Poll};
use rand;
use tower;
use tower_balance::{self, choose, load, Balance};
use tower_buffer::Buffer;
use tower_discover::{Change, Discover};
use tower_in_flight_limit::InFlightLimit;
use towe... |
extern crate hyper;
extern crate futures;
extern crate tokio_proto;
#[macro_use]
extern crate serde_json;
extern crate wordcut_engine;
extern crate config;
use futures::future;
use futures::Stream;
use futures::Future;
use hyper::header::{ContentLength, ContentType};
use hyper::server::{Http, Request, Response, Servi... |
use std::borrow::Borrow;
use std::hash::Hash;
use crate::locale::Locale;
use crate::road::Direction;
use crate::tag::{TagKey, Tags};
use crate::transform::tags_to_lanes::{Infer, Oneway, RoadBuilder};
use crate::transform::{RoadWarnings, TagsToLanesMsg};
const BUSWAY: TagKey = TagKey::from_static("busway");
const ONEW... |
use std::fmt::{Display, Formatter, Result};
pub const START_ESCAPE_ASCII: &str = "\x1b[";
pub const END_ESCAPE_ASCII: &str = "m";
/// Set Graphic(s) Rendition (SGR)
/// SGR Set attributes i.e modifier
/// it contains enums to apply modifiers effects
#[derive(Clone, Copy, Eq, PartialEq)]
pub enum SGRSet {
Bold =... |
//Copyright 2019 <NAME> <<EMAIL>> <<EMAIL>>
use std::slice::Iter;
use crate::diff::{DiffPlus, DiffPlusParser};
use crate::diff_stats::DiffStatParser;
use crate::lines::*;
use crate::text_diff::DiffParseResult;
use crate::MultiListIter;
pub struct PatchHeader {
lines: Lines,
comment: (usize, usize),
descr... |
#[doc = "Reader of register AFEC_ISR"]
pub type R = crate::R<u32, super::AFEC_ISR>;
#[doc = "Reader of field `EOC0`"]
pub type EOC0_R = crate::R<bool, bool>;
#[doc = "Reader of field `EOC1`"]
pub type EOC1_R = crate::R<bool, bool>;
#[doc = "Reader of field `EOC2`"]
pub type EOC2_R = crate::R<bool, bool>;
#[doc = "Reade... |
#[macro_use]
extern crate lazy_static;
extern crate regex;
extern crate reqwest;
extern crate serenity;
extern crate url;
#[macro_use]
extern crate serde;
use anyhow::Result;
use regex::Regex;
use serenity::{
async_trait,
model::{channel::Message, gateway::Ready},
prelude::*,
};
use std::{collections::Hash... |
// Copyright (c) The cargo-guppy Contributors
// SPDX-License-Identifier: MIT OR Apache-2.0
use crate::platform::{Platform, PlatformSpec};
use std::ops::{BitAnd, BitOr};
use target_spec::TargetSpec;
/// The status of a dependency or feature, which is possibly platform-dependent.
///
/// This is a sub-status of [`Enab... |
use num::Zero;
use std::fmt::Debug;
use std::ops::{AddAssign, Div, Mul};
use std::path::Path;
use std::sync::Arc;
use log::{debug, info, warn};
use crate::bounds::Bounds2i;
use crate::fileutil;
use crate::imageio::read_image;
use crate::interaction::SurfaceInteraction;
use crate::mipmap::{MIPMap, WrapMode};
use crate... |
use super::{UdpEchoReq, UdpEchoResp};
use config::UDP_RENDEZVOUS_PORT;
use mio::{Poll, PollOpt, Ready, Token};
use socket_collection::UdpSock;
use sodium::crypto::box_;
use sodium::crypto::sealedbox;
use std::any::Any;
use std::cell::RefCell;
use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4};
use std::rc::Rc;
use {Int... |
use super::traits::View as ViewTrait;
use crate::application::buffer::Buffer;
use crate::application::modes::Modes;
use crate::display::{Display, Point, Rect};
use crate::highlight::Highlighter;
use ropey::Rope;
use std::io::{stdout, BufWriter, Stdout, Write};
use termion;
use termion::raw::{IntoRawMode, RawTerminal};
... |
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum SELinux {
Disabled,
Permissive,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Engine {
Auto,
Classic,
Qemu2,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Netspeed {
Gsm,
Hscsd,
Gprs,
Wdge,
Umts,
Hsdp... |
// Copyright 2020 - 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 i... |
use crate::error::{FusionServiceError, Result};
use arrow_deps::datafusion::{
arrow::datatypes::SchemaRef,
error::Result as DataFusionResult,
physical_plan::{
common::{compute_record_batch_statistics, SizedRecordBatchStream},
Distribution, ExecutionPlan, Partitioning, SendableRecordBatchStre... |
extern crate rand;
#[macro_use]
extern crate serde_derive;
extern crate serde_qs as qs;
extern crate serde_urlencoded as urlencoded;
use rand::seq::SliceRandom;
use std::collections::HashMap;
use qs::Config;
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
struct Address {
city: String,
postcode: S... |
/// All available Opcodes.
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum Opcode {
/// Illegal Instruction.
IGL,
/// Load - Loads a 32-bit integer in a register.
LOAD,
/// Add - Adds the values of the first two registers, storing the result in the third.
ADD,
/// Substract - Subtracts ... |
//! The Riptide programming language interpreter.
#![allow(dead_code)]
use crate::editor::{Editor, ReadLine};
use riptide_runtime::{
prelude::*,
syntax::source::SourceFile,
};
use std::{
io::Read,
path::{Path, PathBuf},
process,
};
use structopt::StructOpt;
use tokio::signal;
mod buffer;
mod comp... |
use crate::framed::Framed;
use crate::pipeline::{create_viz_pipeline, open_config_or_default, VizPipelineConfig};
use crate::player::WavPlayer;
use crate::util::{log_timed, VizFloat};
use crate::wav::WavFile;
use anyhow::Result;
use sdl2::event::Event;
use sdl2::keyboard::Keycode;
use sdl2::pixels::Color;
use sdl2::rec... |
use std::io::{self, Cursor};
use tokio::io::{AsyncRead, AsyncWrite};
/// A type which contains a stream of request and response data, typically
/// backed by a network connection.
pub trait Stream: AsyncRead + AsyncWrite + Unpin {}
// Blanket implementation for Stream.
impl<T: AsyncRead + AsyncWrite + Unpin> Stream f... |
use fast_xml::{
events::{attributes::Attributes, Event},
Reader,
};
use std::{borrow::Cow};
use crate::buf::BufPool;
use crate::FromXmlWithReader;
#[macro_export]
macro_rules! console_log {
($($t:tt)*) => (crate::js_bind::log(&format_args!($($t)*).to_string()))
}
pub type TextOrCData = Option<String>;
pub... |
use std::io::Write;
use crate::language::{Language, Params, RustAlgebraicEnum, RustConstEnum, RustStruct};
pub struct TypeScript {}
fn typescript_type(s: &str) -> &str {
match s {
"str" | "String" => "string",
"i8" | "i16" | "i32" | "i64" | "i128" => "number",
"u8" | "u16" | "u32" | "u64"... |
//! Utilities for managing database schema changes.
mod migration_schema_v6;
mod migration_schema_v7;
mod migration_schema_v8;
mod migration_schema_v9;
mod types;
use crate::beacon_chain::{BeaconChainTypes, FORK_CHOICE_DB_KEY};
use crate::persisted_fork_choice::{PersistedForkChoiceV1, PersistedForkChoiceV7};
use slog:... |
use crate::event::{Event, MouseButton};
use crate::screen_units::Screen2d;
use glium::glutin as gl;
use noisy_float::prelude::*;
/// Persistant state associated with the events. This keeps track of things like which control keys
/// are currently pressed, location of the mouse, and the state of the mouse buttons.
#[de... |
use super::Msg;
use std::ops::Deref;
#[allow(missing_docs)]
#[derive(Debug, Copy, Clone, Eq, Hash, PartialEq)]
/// # Message Kind.
///
/// This enum contains built-in prefixes for [`Msg`](crate::Msg). These are
/// generally only used to initiate a new message with this prefix, like:
///
/// ## Examples
///
/// ```n... |
// Copyright 2021. 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::collections::HashMap;
use once_cell::sync::Lazy;
use crate::utils;
static INPUT: Lazy<Vec<String>> = Lazy::new(|| utils::get_input_as_vec(INPUT_PATH));
const INPUT_PATH: &str = "input/day12";
#[derive(Debug)]
struct Graph<'a> {
nodes: HashMap<&'a str, usize>,
adjacency_matrix: Vec<Vec<usize>>,
}
i... |
//! A simple [run-length-encoding](https://en.wikipedia.org/wiki/Run-length_encoding)
//! implementation for light compression
//!
//! ## Examples
//!
//! Encoding:
//!
//! ```rust
//! fn main() {
//! let data = &[44, 43, 6, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 3];
//! let compressed = rle::compress(... |
use std::collections::HashSet;
use std::ops::Deref;
use std::path::Path;
use std::rc::Rc;
use futures_util::StreamExt;
use regex::Regex;
use reqwest::header::{HeaderMap, HeaderValue};
use reqwest::{Url, Response};
use tokio_dl_stream_to_disk::error::ErrorKind as TDSTDErrorKind;
use tokio::time::{sleep, Duration as Tok... |
// Copyright Materialize, Inc. All rights reserved.
//
// 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 in the LICENSE file at the
// root of this repository, or online at
//
// http://www.a... |
use core::fmt;
impl fmt::Display for crate::Instruction {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.opcode)?;
for i in 0..self.operand_count {
f.write_str(" ")?;
write!(f, "{:?}", self.operands[i as usize])?;
if i + 1 < self.oper... |
use std::path::Path;
use crate::string::{file_as_string, str_as_f64, str_as_u8};
#[derive(Debug)]
pub struct Map {
pub layers: Vec<MapLayer>,
}
#[derive(Debug)]
pub struct MapLayer {
pub id: usize, // 0 = base
pub labels: Vec<MapLabel>,
pub lines: Vec<MapLine>,
}
#[derive(Debug, PartialEq)]
pub stru... |
use crate::challenge::GenerateChallengeResp;
use crate::combine::generate_combined_pubkey;
use crate::generate_challenge;
use crate::issue::IssueMemberReq;
use crate::issue_member;
use crate::utils::verify;
use crate::utils::verify_issuer_cert;
use crate::gm;
use crate::pubkey::pubkey;
use crate::pubkey::GetPubkeyReq;... |
//! Interactive prompt where the user chooses from a list of options
use crate::{
utils::{
calc_entries, is_abort_event, print_input_icon, print_state_icon, Figures, PromptState,
},
Prompt,
};
use async_trait::async_trait;
use crossterm::{
cursor,
event::{Event, EventStream, KeyCode, KeyEve... |
//! A `proc-macro` to convert a struct into Vec<u8> and back by implemeting `From` trait on the struct.
//! The conversion is Big Endian by default.
//!
//! We have made the following assumptions about the the struct:
//!
//! - The struct must have fields.
//! - The fields are public.
//! - The fields have the followi... |
use crate::ctx::Context as PlatformContext;
use anyhow::Result;
use chrono::prelude::*;
use pico_args::Arguments;
use qute_ctrl::{platform::Platform, FanControl, Temperature};
use std::{str::FromStr, thread::sleep, time::Duration};
pub fn run(args: &mut Arguments, ctx: &PlatformContext) -> Result<()> {
if ... |
use std::fmt;
use std::slice::Iter;
use std::ops::Deref;
use std::rc::Rc;
use namespace::Namespace;
use line_info::LineInfo;
#[macro_use]
macro_rules! word {
($kind: expr, $line_info: expr) => { Word { kind: $kind, line_info: $line_info } }
}
#[derive(Clone, Debug)]
pub struct Program {
pub code: Vec<Statemen... |
use std::sync::atomic;
use super::{CustomPtr, Level, PtrTarget};
#[derive(Debug)]
pub struct Entry<T> {
key: u64,
data: T,
pub next: CustomPtr<T>,
}
impl<T> Entry<T> {
/// Creates a new simply Entry
pub fn new(key: u64, data: T, next: CustomPtr<T>) -> Self {
Self { key, data, next }
}... |
//! Extension programs.
use std::os::unix::prelude::{AsRawFd, RawFd};
use thiserror::Error;
use object::Endianness;
use crate::{
generated::{bpf_attach_type::BPF_CGROUP_INET_INGRESS, bpf_prog_type::BPF_PROG_TYPE_EXT},
obj::btf::BtfKind,
programs::{
define_link_wrapper, load_program, FdLink, FdLink... |
#![warn(clippy::unwrap_used)]
#![warn(clippy::expect_used)]
use crate::{
font,framebuffer,
graphics::{Color, Draw, Point, Rectangle, Size}, desktop,
};
use core::{convert::TryFrom, fmt};
const ROWS: usize = 25;
const COLUMNS: usize = 80;
//マクロの記法わからん
#[macro_export]
macro_rules! print {
($($arg:tt)*) ... |
// 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 std::collections::{HashMap, HashSet};
type EntityReference = String;
pub struct StoryContextStore {
context_entities: HashMap<EntityReference, Co... |
//! Terminal console functionalities.
use crate::{
attach::SharedContainerAttach,
container_io::{ContainerIO, Message, Pipe},
container_log::SharedContainerLog,
};
use anyhow::{bail, format_err, Context, Result};
use getset::{Getters, MutGetters, Setters};
use libc::{self, winsize, TIOCSWINSZ};
use log::{d... |
use std::{collections::HashMap, error::Error, fs, path::Path};
use rusqlite::{params, Connection};
use serde::{Deserialize, Serialize};
#[derive(Debug)]
pub struct DatabaseConnection {
connection: Connection,
}
impl DatabaseConnection {
pub fn new(
url: &str,
init: &str,
alternatives:... |
//! zombiesplit's notion of times.
use serde_with::{DeserializeFromStr, SerializeDisplay};
use std::{
convert::TryFrom,
fmt::{self, Display},
iter::Sum,
str::FromStr,
};
pub mod carry;
pub mod error;
pub mod field;
pub mod position;
pub use error::Error;
pub use field::Field;
pub use position::{Hour, ... |
mod frame_buffer;
mod map;
mod player;
mod texture;
mod utils;
use crate::frame_buffer::FrameBuffer;
use crate::map::Map;
use crate::player::Player;
use crate::texture::Texture;
use crate::utils::{drop_ppm_image, pack_color};
use std::f32::consts::PI;
use std::fs::create_dir_all;
fn wall_x_texcoord(x: f32, y: f32, te... |
//
// Copyright (c) 2019 Stegos AG
//
// 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, ... |
use std::cell::RefCell;
use std::fs::File;
use std::io::{Read, Write};
use std::io;
use std::rc::Rc;
use crate::apu::APU;
use crate::controller::Controller;
use crate::ppu::PPU;
pub trait Memory {
fn read(&mut self, _address: u16) -> u8 { 0 }
fn write(&mut self, _address: u16, _val: u8) { }
fn save(&self,... |
extern crate petgraph;
extern crate fnv;
use std::path;
use fnv::FnvHashMap;
use fnv::FnvHashSet;
use petgraph::Graph;
use std::iter::FromIterator;
use std::io::BufReader;
use std::io::BufWriter;
use std::io::prelude::*;
use std::fs::File;
use std::fmt;
use std::path::Path;
use std::iter::Iterator;
struct Square... |
use rand::Rng;
use std::{cell::RefCell, rc::Rc};
use crate::{
backends::common::cpatch::{flatten, ChangeList, CurveBvh},
canvas::{Canvas, CanvasOps, CanvasOptions},
color::{Color, Space as ColorSpace},
hash::hash_of,
image::{Error as ImageError, Image, PixelFormat},
math::vector2::Vec2,
pai... |
use proc_macro::TokenStream;
use quote::quote;
use syn::{punctuated::Punctuated, spanned::Spanned, token::Comma, *};
#[proc_macro_derive(Builder, attributes(builder))]
pub fn derive(input: TokenStream) -> TokenStream {
let st = parse_macro_input!(input as DeriveInput);
match do_expand(&st) {
Ok(token_s... |
use framework;
use framework::namespace;
use framework::endpoint;
use framework::client;
use json::{JsonValue};
use backend;
use server::method;
use errors;
pub trait Node {
fn get_handlers<'a>(&'a self) -> &'a framework::ApiHandlers;
fn get_handlers_mut<'a>(&'a mut self) -> &'a mut framework::ApiHandlers;
... |
use super::SearchError;
use crate::vec2d::Vec2D;
use ndarray::{ArrayBase, Data, Ix2};
/// An element in a possible labelling.
#[derive(Clone, Copy, Debug)]
struct LabelNode {
/// The index into the alphabet of this label.
///
/// Note that blanks are not represented by a LabelNode - this is an actual label... |
// SPDX-FileCopyrightText: 2020 <NAME> <<EMAIL>>
// SPDX-License-Identifier: CC0-1.0
use std::env;
use genpdf::Alignment;
use genpdf::Element as _;
use genpdf::{elements, fonts, style};
const FONT_DIRS: &[&str] = &[
"/usr/share/fonts/liberation",
"/usr/share/fonts/truetype/liberation",
];
const DEFAULT_FONT_... |
use std::collections::HashMap;
fn main() {
let input = include_str!("../input");
let mut grid = Grid::new(input.trim());
grid.get_seeing_counts();
println!("Best location is: {:?}", grid.best_location());
}
struct Grid {
width: usize,
height: usize,
asteroid_locations: HashMap<(usize, usiz... |
use super::{Result, SplineCurve};
use plotters::{prelude::*};
use std::iter::repeat;
fn range_knots<const K:usize, const N:usize>(s: &SplineCurve<K,N>) -> Result<[f64;4]> {
let nc = s.c.len();
let nc_2 = nc/2;
let (x_min, x_max) = match N {
1 => (
s.t.iter().cloned().reduce(f64::min)... |
use anyhow::{anyhow, Context, Result};
use nix::fcntl::OFlag;
use nix::libc::c_int;
use nix::sys::signal;
use std::convert::From;
use std::fs::File;
use std::io::{Read, Write};
use std::ops::Deref;
use std::os::unix::io::FromRawFd;
use std::os::unix::prelude::CommandExt;
use std::process::Command;
pub struct CommandBy... |
//! This module combines many of the other modules to provide a safe wrapper
//! around the modules like windowing and renderering. It will allow for sharing
//! of data around from the window to the renderer, without sacrificing much usability for
//! the user.
use std::time::{Duration, Instant};
use crate::{layout:... |
#![allow(dead_code)]
use std::sync::Arc;
use crate::db::api::*;
use crate::db::storage::*;
use crate::db::common::unsafe_util;
use super::codec::*;
use super::property::*;
use super::types::*;
use super::bin::*;
pub struct VertexImpl {
id: VertexId,
label: LabelId,
data: PropData<'static>,
decoder: De... |
use std::ops::Range;
use cgmath::Point3;
#[macro_use]
mod util;
mod mandelbulb;
mod sphere;
#[cfg(test)]
mod bench;
pub use self::mandelbulb::Mandelbulb;
pub use self::sphere::Sphere;
/// Describes a 3D object that can be rendered by this application.
///
/// Unlike in standard real time 3D graphics, the object is ... |
//! Helpful utility functions, macros and structs.
/// All OSRS specific utilities.
pub mod osrs;
use std::{
path::Path,
collections::HashMap,
fs::File,
io::{ BufReader, self, Read }
};
use crate::{
store::Store,
cache::{ MAIN_DATA, IDX_PREFIX, REFERENCE_TABLE},
idx::Index,
Definiti... |
use winapi::{
shared::{dxgi, dxgi1_2, dxgi1_4, dxgi1_6, winerror},
Interface,
};
use super::result::HResult as _;
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord)]
pub enum DxgiFactoryType {
Factory1,
Factory2,
Factory4,
Factory6,
}
pub fn enumerate_adapters(factory: native::DxgiFactory) -> Ve... |
use std::cmp::Ordering;
use std::collections::{HashMap, HashSet, VecDeque};
use std::convert::TryFrom;
use std::io;
use crate::error::Error;
use crate::utils::{Vec2, F64};
type Point = Vec2<i64>;
pub fn run<R>(reader: R) -> Result<(String, String), Error>
where
R: io::BufRead,
{
// Parse input
let points... |
use std::ops::Mul;
use tetra::input::{self, Key};
use tetra::{time, Context, ContextBuilder, State};
use tetra::graphics::Color;
mod dailyrium;
mod elements;
mod engine;
mod living_entities;
mod rl_tetra;
mod world_factory;
use dailyrium::Action;
use engine::puppet_master;
use rl_tetra::Terminal;
use world_factory::... |
// Copyright (c) 2015-2016 lcov-parser 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 ... |
use crate::Error;
#[derive(Copy, Clone)]
pub struct String<const N: usize> {
bytes: [u8; N],
len: u32, // length in bytes, not characters
}
impl<const N: usize> String<N> {
pub fn new() -> String<N> {
String {
bytes: [0; N],
len: 0,
}
}
pub fn from_str<T>(s... |
use crate::errors::*;
use aes::{chunks_count, BLOCK_SIZE};
use crate::prefix_suffix_oracles::Oracle12;
use crate::prefix_suffix_oracles::{DeterministicOracle, Oracle};
use super::challenge11::uses_ecb;
pub fn block_size<T: Oracle>(oracle: &T) -> Result<usize> {
let mut input = Vec::new();
let initial_len = o... |
use std::collections::HashMap;
use crate::definitions::{BitmaskData, Input, MemoryData};
mod parse;
mod definitions;
pub fn solve() -> (i64, i64) {
let input = include_str!("./input");
let state = solve_v1(input);
let sum_1: i64 = state.data.values().sum();
println!("the sum of all instructions v1 ... |
use crate::instr::{IRArg, IROp, Instr};
use kolgac::{
ast::Ast,
token::{TknTy, Token},
ty_rec::TyRecord,
};
#[derive(Debug)]
pub struct IRGen<'t> {
/// Syntax tree obtained from parsing. This is assumed to
/// be valid at this stage.
pub ast: &'t Ast,
/// The resulting three address linea... |
use js_sys::Promise;
use std::future::Future;
use std::mem::ManuallyDrop;
use std::pin::Pin;
use std::sync::atomic::{AtomicI32, Ordering::SeqCst};
use std::sync::Arc;
use std::task::{Context, Poll, RawWaker, RawWakerVTable, Waker};
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
// Duplicate a bit here because... |
use std::{
fmt::Debug,
collections::HashMap
};
use regex::Regex;
pub enum Input {
Rule,
Ticket,
NearbyTicket,
}
#[derive(PartialEq, Eq, Clone, Debug)]
pub struct Ticket {
pub rules: Vec<(String, String, String)>,
pub ticket: Vec<String>,
pub nearby_tickets: Vec<String>
}
impl Ticket {
pub fn new()... |
//! LLVM Targets
use super::llvm_sys::core::LLVMDisposeMessage;
use super::llvm_sys::target_machine::*;
use failure::Fail;
use std::ffi::{CStr, CString};
use std::{fmt, ptr};
/// Compilation Target
///
/// Represents a validated target triple. Can be used to build a
/// target machine to compile to.
pub struct Target... |
// 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 crate::{proxies::player::PlayerProxyEvent, Result, SessionId, CHANNEL_BUFFER_SIZE};
use fidl::endpoints::ClientEnd;
use fidl_fuchsia_media_sessions2::*... |
use crate::datetime::Timestamp;
use crate::{
channel::permission_overwrite::{PermissionOverwrite, PermissionOverwriteType},
gateway::presence::Presence,
guild::Permissions,
id::{GuildId, RoleId, UserId},
};
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serializ... |
//! sync git api
//TODO: remove once we have this activated on the toplevel
#![deny(clippy::expect_used)]
pub mod branch;
mod commit;
mod commit_details;
mod commit_files;
mod commits_info;
pub mod cred;
pub mod diff;
mod hooks;
mod hunks;
mod ignore;
mod logwalker;
mod patches;
pub mod remotes;
mod reset;
mod stagin... |
//! Contains Refinery macros
//!
//! used to import and embed migration files
#![recursion_limit = "128"]
extern crate proc_macro;
mod util;
use proc_macro::TokenStream;
use proc_macro2::{Span as Span2, TokenStream as TokenStream2};
use quote::quote;
use quote::ToTokens;
use std::ffi::OsStr;
use syn::{parse_macro_inp... |
// 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 {
crate::{
directory::{
entry::DirectoryEntry,
entry_container::{Directory, MutableDirectory},
},
f... |
use crate::core::interfaces::*;
use crate::core::ir::{Intrinsic, Operation, SupportsInterfaceTraits};
use color_eyre::{eyre::bail, Report};
use downcast_rs::{impl_downcast, Downcast};
use std::{collections::HashMap, hash::Hash, sync::RwLock};
/// A trait object which supports caching of `AnalysisPass` instances
/// by... |
//! Defines `DataContext`.
use cranelift_codegen::binemit::{Addend, CodeOffset};
use cranelift_codegen::entity::PrimaryMap;
use cranelift_codegen::ir;
use std::boxed::Box;
use std::vec::Vec;
/// This specifies how data is to be initialized.
#[derive(PartialEq, Eq, Debug)]
pub enum Init {
/// This indicates that n... |
//! First Person View Camera GameObject that can capture a scene
//!
//! TODO
//!
use {
super::{
Camera,
super::{
GameObject,
light::Light,
}
},
crate::{
registration::{
relation::{
Child, Parent,
... |
// use web_sys::console::log_1;
// log_1(&format!("{}", self.objects.len()).into());
use std::cell::RefCell;
use crate::utils::uuid;
use crate::audio::AudioPlayer;
use super::Tile;
use super::character::{Character, Player};
use super::object::{
Object,
Projectile,
};
use crate::game::level::LevelManager;
use cr... |
use crate::highlight::highlight;
use crate::app::FontSelection;
use crate::app::State;
pub trait TextBackend {
fn num_lines(&self) -> usize;
fn num_chars_of_line(&self, y: usize) -> usize;
// width of chars `0..x_max`
// x_max is in range 0..=line_len
fn width_of_line(&self, y: usize, x_max: usiz... |
use super::{tcflag_t, cc_t, speed_t};
/* c_cc { */
pub const VEOF: cc_t = 0;
pub const VEOL: cc_t = 1;
pub const VEOL2: cc_t = 2;
pub const VERASE: cc_t = 3;
pub const VWERASE: cc_t = 4;
pub const VKILL: cc_t = 5;
pub const VREPRINT: cc_t = 6;
pub const VSWTC: cc_t = 7;
pub const VINTR: cc_t = 8;
pub const VQUIT: cc_t... |
// Copyright 2019 <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, distribu... |
use crate::{opts::forge::ContractInfo, suggestions};
use clap::Parser;
use ethers::{
abi::Abi,
core::types::Chain,
prelude::ArtifactId,
solc::{
artifacts::{
CompactBytecode, CompactContractBytecode, CompactDeployedBytecode, ContractBytecodeSome,
},
cache::{CacheEntry... |
//! # command
//!
//! Runs task commands/scripts.
//!
#[cfg(test)]
#[path = "./command_test.rs"]
mod command_test;
use crate::logger;
use crate::toolchain;
use crate::types::{CommandSpec, Step};
use envmnt;
use run_script;
use run_script::{IoOptions, ScriptError, ScriptOptions};
use std::io;
use std::io::Error;
use s... |
use crate::*;
use core::cmp::Ordering;
pub fn is_sorted_by<I, F>(arr: &[I], mut compare: F) -> bool
where
F: FnMut(&I, &I) -> Option<Ordering>,
{
arr.windows(2)
.all(|w| compare(&w[1], &w[0]).unwrap() != Ordering::Less)
}
#[inline(always)]
pub fn combine_slice<'a, T>(a: &'a [T], b: &'a [T]) -> &'a [T... |
use crate::{
control_scheme::ControlScheme, match_menu::MatchMenu, message::Message,
options_menu::OptionsMenu, GameEngine, Gui, GuiMessage, UINodeHandle,
};
use rg3d::{
event::{Event, WindowEvent},
gui::{
button::ButtonBuilder,
grid::{Column, GridBuilder, Row},
message::{ButtonM... |
//! A graph-like structure used to represent a set of dependencies and in what
//! order they should be built.
//!
//! This structure is used to store the dependency graph and dynamically update
//! it to figure out when a dependency should be built.
use std::collections::{HashMap, HashSet};
use std::hash::Hash;
#[de... |
use std::collections::HashMap;
use std::rand;
use std::rand::Rng;
use std::sync::mpsc::{Sender, Receiver};
use std::sync::mpsc::TryRecvError;
use std::sync::{Arc, Mutex};
use std::old_io::timer;
use std::time::Duration;
use messages::{MarketMessages, MarketHistory, ActorMessages, TransactionRequest};
use messages::Act... |
//! Description:
//!
//! System for Commands
//!
//! Copyright © 2020 <NAME>. All rights reserved.
use amethyst::{
//derive::SystemDesc,
core::SystemDesc,
ecs::{Read, WriteStorage, System, SystemData, ReadStorage, World},
};
use amethyst_lyon::{
utils::{Mesh, VertexType}
};
extern crate lyon;
u... |
// 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 {
proc_macro2::{Ident, Span, TokenStream},
quote::{format_ident, quote, quote_spanned},
syn::{
parse_macro_input, spanned::Spanned,... |
use std::hash::Hash;
use ahash::{AHashMap, AHashSet};
/// Input handler for an event-based game engine.
///
/// Use this when your game engine provides inputs via an event system.
///
/// At the top of your game loop, you MUST call [`EventInputHandler::update`] to
/// process the input events its received. The genera... |
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
use crate::{
relay_directive::{MASK_ARG_NAME, PLURAL_ARG_NAME, RELAY_DIRECTIVE_NAME},
should_generate_hack_preloader,
};
... |
use std::io::Write;
use std::{io, mem};
use curve25519_dalek::constants::RISTRETTO_BASEPOINT_TABLE;
use curve25519_dalek::ristretto::{RistrettoBasepointTable, RistrettoPoint};
use curve25519_dalek::scalar::Scalar;
use rand::RngCore;
use strobe_rs::Strobe;
/// Generate a random `u8` array.
#[must_use]
pub fn rand_arra... |
use ipnet::Ipv6Net;
use std::collections::HashMap;
#[derive(getset::Getters, Debug, std::cmp::PartialEq, Clone)]
pub struct NDConfig {
#[get = "pub with_prefix"]
name: String,
#[get = "pub with_prefix"]
proxy_type: u8,
#[get = "pub with_prefix"]
proxied_pfx: Ipv6Net,
#[get = "pub with_prefi... |
use super::StreamingIndexIterator;
use crate::readers::{Index, RAReader, Value};
#[derive(Debug)]
pub struct UnknownSizeIter<'a, R: RAReader> {
ra_reader: &'a R,
// |lowerbounds| = |upperbounds| = |step| = |unknown_upperbounds| = |index|
// |unfrozen_dims| < |index| and in reversed order
lowerbounds: Vec<usize... |
use std::cmp::min;
use std::rc::Rc;
use std::time::Duration;
use crate::loader::Assets;
use crate::{Point, SCREEN_HEIGHT, SCREEN_WIDTH};
use line_drawing::Bresenham;
// This is the type stored in the `Assets` hash map
pub(crate) type CachedSprite = (usize, usize, Rc<Vec<u8>>);
/// Frame identifier for managing anima... |
use arena::{ArenaMap, Id};
use rustc_hash::FxHashMap;
use wasm_encoder::{
CodeSection, DataSection, Export, ExportSection, Function, FunctionSection, Instruction,
MemorySection, MemoryType, Module, TypeSection, ValType,
};
pub(crate) struct Ctx<'a> {
type_section: TypeSection,
function_section: Functio... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.