lang
stringclasses
10 values
seed
stringlengths
5
2.12k
rust
#[doc(hidden)] pub fn list_dir_entries(path: &str) -> Vec<PathBuf> { let mut directory_entries: Vec<PathBuf> = Vec::new(); let directory = std::fs::read_dir(path); if let Ok(dir) = directory { for entry in dir.flatten() { directory_entries.push(entry.path()) }
rust
pub enum OckamError { None, } impl OckamError { pub const DOMAIN_CODE: u32 = 10_000; pub const DOMAIN_NAME: &'static str = "OCKAM_NODE"; } impl Into<Error> for OckamError { fn into(self) -> Error { Error::new(Self::DOMAIN_CODE + (self as u32), Self::DOMAIN_NAME) } }
rust
/// Returns `true` if the given span is a part of generated files. pub(super) fn is_generated_file(original_snippet: &str) -> bool { original_snippet .lines() .take(5) // looking for marker only in the beginning of the file .any(|line| line.contains("@generated")) }
rust
} impl IdealSoliton { pub fn new(k: usize, seed: u64) -> IdealSoliton { let rng = SeedableRng::seed_from_u64(seed); IdealSoliton { limit: 1.0 / (k as f32), rng, } } }
rust
assert y == 6; */ let x = @6; let y = x.get(); debug!("y=%d", y); assert y == 6; let x = ~mut 6; let y = x.get(); debug!("y=%d", y); assert y == 6;
rust
pub fn next_step(&self, steps: u32) -> T { nih_debug_assert_ne!(steps, 0); if self.steps_left.load(Ordering::Relaxed) > 0 { let current = self.current.load(Ordering::Relaxed);
rust
assert!(MaxTokens::new(1024, &ENGINE_DEFINITION).is_some()); assert!(MaxTokens::new(1025, &ENGINE_DEFINITION).is_none()); } #[test] fn test_max_tokens_inner() { let max_tokens = MaxTokens::new(1, &ENGINE_DEFINITION).unwrap(); assert_eq!(max_tokens.inner(), 1);
rust
// Copyright 2021 TiKV Project Authors. Licensed under Apache-2.0. use crate::cpu::collector::{Collector, CollectorId}; use std::sync::atomic::AtomicU64; use std::sync::atomic::Ordering::Relaxed; use crossbeam::channel::{unbounded, Receiver, Sender}; use lazy_static::lazy_static;
rust
//~| HELP: consider slicing here let v = vec![]; match &v { //~^ HELP: consider slicing here
rust
) => fold_sub_const(c1, c2)?.map(|c3| { let e1 = mem::take(e1); let e2 = mem::take(e2); let e = Expr::func(FuncKind::Add, vec![e1, e2]); expr_sub_const(e, c3) }), // rule 8.4: (e1-c1)+(e2-c2) => (e1+e2) - (c1+c2) (
rust
Err(error) => { return reader::Result::Err( reader::Error::StdIoError(error) ); } } }
rust
/// /// * Set Google's response to the French language: /// ```rust /// .with_language(Language::French) /// ``` pub fn with_language(&'a mut self, language: Language) -> &'a mut Request { // Set language in Request struct. self.language = Some(language); // Return modified Request struct to caller. self
rust
self.slope } /// Standard error of the estimate. pub fn standard_error(&self) -> f64 { self.standard_error } fn simple_lr(data: &[(f64, f64)]) -> Result<Self, Error> { let n = data.len() as f64; let (x, y): (Vec<_,>, Vec<_>) = data.iter().cloned().unzip();
rust
use super::{Value, Function}; pub enum Object { String(String), Array(Vec<Value>), Function(Function) }
rust
pub stack_trace: ::core::option::Option<StackTrace>, } /// Describes the current state of the execution. More states might be added /// in the future. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum State { /// Invalid state. Unspecified = 0, /// The execution is in progress.
rust
/* GIVEN an OSM client WHEN calling the permissions() function THEN returns a list of permissions for the current user */ // GIVEN let mock_server = MockServer::start().await;
rust
mod force_update; pub use self::force_update::ForceUpdate; pub type AllEventHandlers = (ForceUpdate,); pub type KnownEventSources = ();
rust
let (status_line, filename) = if buffer.starts_with(get) { (success_response, "hello.html") } else { (status_line_404, "404.html") }; // Return the HTML: let contents = fs::read_to_string(filename).unwrap(); let response = format!("{}{}", status_line, contents);
rust
// pub(crate) fn create_post(path: &str) -> RequestBuilder { // REQWEST_CLIENT.post(&format!("http://{}/{}", HOST, path)) // } pub(crate) fn webapi_post<T: Serialize + ?Sized>(path: &str, json: &T) -> Result<Value, String> { let post = REQWEST_CLIENT.post(&format!("http://{}/{}", &*HOST, path)); let response = post .json(json) .send() .map_err(|e| format!("{:?}", e))? .text() .map_err(|e| format!("{:?}", e))?; let value: Value = serde_json::from_str(&response).map_err(|e| format!("{:?}", e))?;
rust
} }; let github = match client.get_commit() { Ok(commit) => Value::Object(vec![ ( Value::String("commit".into()), Value::Link(commit.commit.url, commit.commit.message),
rust
Upiši broj tako da jednakost bude tačna. @repeat(6)@ @center@ @answ@ @/repeat@
rust
assert!(summary.has_no_errors()); file_map[0].1.to_string() } // For these tests, we actually don't verify the token stream word for word.
rust
&mut self.wallet_lib } fn reconnect(&mut self) { self.electrumx_client = ElectrumxClient::new("127.0.0.1:60401".to_string()).unwrap(); } fn send_coins(&mut self, addr_str: String, amt: u64, lock_coins: bool, witness_only: bool, submit: bool) -> Result<(Transaction, LockId), Box<Error>> { let (tx, lock_id) = self.wallet_lib.send_coins(addr_str, amt, lock_coins, witness_only)?; if submit { self.publish_tx(&tx); } Ok((tx, lock_id)) }
rust
fn mutate(&mut self, innovation_id: &mut usize, p: &NeatParams); /// `fittest` is true if `other` is more fit. fn mate(&self, other: &Self, fittest: bool, p: &NeatParams) -> Self; /// TODO: how should it be implemented for e.g. a composed organism?
rust
#![allow(dead_code)] struct Solution; impl Solution { pub fn two_city_sched_cost(mut costs: Vec<Vec<i32>>) -> i32 { // Since we want to fly half the people to city A and the other half // to city B (in the cheapest way possible), we can sort the costs // array by the gains of flying people to city A over flying them // to city B. This can be achieved with cost[i][0] - cost[i][1]. If the
rust
} } fn get_rate(&self, date: NaiveDate) -> Result<Decimal, PricesError> { let mut rate: Option<Decimal> = None; for (key, value) in self.table.iter() { if *key <= date {
rust
let b = Fr::from_str("3").unwrap(); let c = Fr::from_str("5").unwrap(); assert!(c == (a+b)); let alpha = Fr::random(rng); let beta = Fr::random(rng);
rust
// server. encoder .no_suffix()? .no_bucket()? .encode_value(rand::random::<u32>())? .no_exemplar()?; Ok(()) }
rust
mod deployment_status; pub use deployment_status::*;
rust
use advent_of_code_2019::intcode::{Machine, ProgramMachine}; use advent_of_code_2019::vector2d::Vector2D; fn main() { let program: Vec<i64> = parse_list(include_str!("input"), ','); println!("Answer to part 1: {}", part1(&program)); println!("Answer to part 2: {}", part2(&program)); } #[derive(Debug, Eq, PartialEq, Hash, Copy, Clone)] enum Direction { North, South,
rust
NonPrefabWireType::Bit32 => WireType::Bits32, NonPrefabWireType::Bit64 => WireType::Bits64, NonPrefabWireType::Bit128 => WireType::Bits128, NonPrefabWireType::Varint => WireType::Varint, NonPrefabWireType::LengthDelimited => WireType::LengthDelimited, } } }
rust
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // error-pattern:aFdEfSeVEE /* We're testing that link_args are indeed passed when nolink is specified. So we try to compile with junk link_args and make sure they are visible in the compiler output. */ #[link_args = "aFdEfSeVEEE"]
rust
})*) => { $( paste! { #[function_component([<$name Input>])] pub fn [<$name:snake:lower _input>]() -> Html { let app = use_store::<AppStore>(); let form = use_store::<BasicStore<FormState>>(); let oninput = form.dispatch().input(|state, value| state.$form_accessor $([$form_idx])? = value.parse::<f64>()); html! { <FormGroup success={form.state().map(|state| (state.$form_accessor $([$form_idx])?).is_ok())}> <Input<f64, ParseFloatError> label=$label desc=$desc default={app.state().map(|state| state.$app_accessor $([$app_idx])?).unwrap_or_else(|| AppState::default().$app_accessor $([$app_idx])?)} parsed={form.state().map(|state| (state.$form_accessor $([$form_idx])?).clone())}
rust
#![doc(html_root_url = "https://docs.rs/matrixmultiply/0.2/")] #![cfg_attr(not(feature = "std"), no_std)] #[cfg(not(feature = "std"))] extern crate alloc; #[cfg(feature = "std")] extern crate core; extern crate rawpointer; #[macro_use] mod debugmacros; #[macro_use] mod loopmacros; mod archparam;
rust
} } previous_proof = Some(proof); // Check that the proof is within the reporting window. if !proof.is_valid_at(block_height) { return Err(BlockError::InvalidForkProof); } }
rust
.await?; */ let log_events = client .get_log_events() .log_group_name("test-logs") .log_stream_name("test-stream") .send() .await?; let events = log_events.events.unwrap_or_default(); println!("number of events: {}", events.len()); for event in events { println!("message: {}", event.message.unwrap_or_default()); } Ok(()) }
rust
\n AggregatorFinal: groupBy=[[]], aggr=[[count(0)]]\ \n Projection: {\"Struct\":[{\"UInt64\":10000}]} as count(0):Utf8\ \n Expression: {\"Struct\":[{\"UInt64\":10000}]}:Utf8 (Exact Statistics)\ \n ReadDataSource: scan partitions: [1], scan schema: [dummy:UInt8], statistics: [read_rows: 1, read_bytes: 1]"; let actual = format!("{:?}", optimized); assert_eq!(expect, actual); Ok(())
rust
// This are the "normal" characters section "newline" => '\n'.to_string(), "enter" => '\n'.to_string(), "nl" => '\n'.to_string(), "tab" => '\t'.to_string(), "sp" => ' '.to_string(), "space" => ' '.to_string(), "pipe" => '|'.to_string(), "left_brace" => '{'.to_string(), "lbrace" => '{'.to_string(), "right_brace" => '}'.to_string(), "rbrace" => '}'.to_string(),
rust
// This is filled in by the emit_opcodes macro. It can be printed using the // "//hphp/hack/src/hackc/hhbc:dump-opcodes" binary. } // The macro also generates: // impl Opcode<'arena> {
rust
w.block(|w| mdef.ast_debug(w)); w.new_line(); } for (n, s) in scripts { w.write(&format!("script {}", n)); w.block(|w| s.ast_debug(w)); w.new_line() }
rust
self.0.insert("description", Value::from(description.to_string())); self } /// The Discord name of a unicode emoji representing the sticker's expression. /// /// **Note**: Must be between 2 and 200 characters long. pub fn tags<S: ToString>(&mut self, tags: S) -> &mut Self { self.0.insert("tags", Value::from(tags.to_string())); self } }
rust
pub fn display(indent: usize, node: &Handle, default_style: &Style) -> Style { let mut style: Style = *default_style; print!("{}", repeat(" ").take(indent).collect::<String>()); match node.data { NodeData::Text { ref contents } => { let line: &str = &contents.borrow(); println!("{}", style.paint(line)); } NodeData::Element { ref name, ref attrs, .. } => {
rust
pub struct Slog; impl Slog { pub fn init(level: LevelFilter) { if let Err(e) = log::set_logger(&SLOG) { // 重复设置日志记录 log::error!("initialization log error, the error information is: {:?}", e); return; }
rust
Class, Method, Field, Import, Function, Interface, } pub struct Validator<'l> { parent_is_class: bool, elements: HashMap<String, Kind>, children: HashMap<String, Kind>,
rust
* - The absolute simplest filter is: . * This is a filter that takes its input and produces it unchanged as output. That is, this is the identity operator. * * Object Identifier-Index: .foo, .foo.bar * - The simplest useful filter is: .foo * When given TOML as an input, it gets the value in the table row "foo" * * Optional Object Identifier Index: .foo? * - Just like .foo, but does not output even an error when . is not an array or an object. * * Generic Object Index: .[<string>]
rust
// `_mutable_integer`を借用 let _large_integer = &_mutable_integer; // エラー! `_mutable_integer`はこのスコープではフリーズしている。 _mutable_integer = 50; // FIXME ^ この行をコメントアウトしましょう。 // `_large_integer`はスコープを抜ける } // OK! `_mutable_integer`はこのスコープではフリーズしていない。 _mutable_integer = 3;
rust
milk: Vec::with_capacity(1), sugar: Vec::with_capacity(1), }) } pub fn set_black_coffee(mut self) -> Self { self.0.sort = "Black".into(); self } pub fn set_cubano_coffee(mut self) -> Self { self.0.sort = "Cubano".into(); self.0.sugar.push(Sugar { sort: "Brown".into(), });
rust
let mut del_mode_ptr = enums::ODPIMessageDeliveryMode::NotSet; try_dpi!( externs::dpiMsgProps_getDeliveryMode(self.inner, &mut del_mode_ptr), Ok(del_mode_ptr), ErrorKind::MsgProps("dpiEnqOptions_getMode".to_string()) ) } /// Returns the time that the message was enqueued.
rust
let device_raw = match self .library .create_device(self.adapter, native::FeatureLevel::L11_0) { Ok((device, hr)) if winerror::SUCCEEDED(hr) => device, Ok((_, hr)) => { error!("error on device creation: {:x}", hr); return Err(hal::device::CreationError::InitializationFailed); }
rust
mod lexer; pub use lexer::lex; #[cfg(test)] mod tests { use super::lexer; #[test]
rust
Ok(0) } fn set_robust_list(&self, head: UserInPtr<RobustList>, len: usize) { self.lock_linux().robust_list = head;
rust
if is_option_ty(&self.ty) { "option" } else if self.column_name.is_none() && self.field_name.is_none() { "bare" } else { "regular" } } }
rust
pub fn push_row<__RowData: ::core::convert::Into<#origin_struct_name #ty_generics>>( &mut self, data: __RowData, ) { self.insert_row(#root::Table::row_cnt(&self.0), data) } }
rust
use dustbox::machine::Machine; fn exec_simple_loop(c: &mut Criterion) { let mut machine = Machine::deterministic(); let code: Vec<u8> = vec![ 0xB9, 0xFF, 0xFF, // mov cx,0xffff 0x49, // dec cx 0xEB, 0xFA, // jmp short 0x100 ]; machine.load_executable(&code, 0x085F); c.bench_function("execute small jmp short loop", move |b| b.iter(|| machine.execute_instruction())); }
rust
runner( vec![ passing_test("Example passing test", test_pass), failing_test( "Example failing test", test_fail, "the test is not implemented", None, ), ], vec![], ) }
rust
fn set_compute_root_dt<H: Into<::winapi::D3D12_GPU_DESCRIPTOR_HANDLE>> ( &mut self, param_index: u32, base_descriptor: H ); } macro_rules! impl_common_with_heap_commands{ ($Type: ident, $($T: tt),+) => { impl<$($T),+> CommandListWithHeap for $Type<$($T),+> { /// set a decriptor table in the graphics root signature #[inline] fn set_graphics_root_dt<H: Into<::winapi::D3D12_GPU_DESCRIPTOR_HANDLE>> ( &mut self, param_index: u32, base_descriptor: H ) {
rust
) -> ReturnDest<'tcx, Bx::Value> { // If the return is ignored, we can just return a do-nothing `ReturnDest`. if fn_ret.is_ignore() { return ReturnDest::Nothing; } let dest = if let Some(index) = dest.as_local() { match self.locals[index] { LocalRef::Place(dest) => dest, LocalRef::UnsizedPlace(_) => bug!("return type must be sized"), LocalRef::Operand(None) => {
rust
extern crate nanomsg; #[macro_use] extern crate log; pub mod reqrep;
rust
impl_task_function!(T1); impl_task_function!(T1, T2); impl_task_function!(T1, T2, T3); impl_task_function!(T1, T2, T3, T4); impl_task_function!(T1, T2, T3, T4, T5);
rust
let mut tess = FillTessellator::new(); let options = FillOptions::default().with_tolerance(1000000.0); bench.iter(|| { for _ in 0..N { let mut buffers: VertexBuffers<Point, u16> = VertexBuffers::new(); tess.tessellate_path(&path, &options, &mut simple_builder(&mut buffers)) .unwrap();
rust
} fn wrap(&self) -> Instruction { Instruction::And((*self).clone()) } }
rust
c[l][m] = vadd(a[l][m], b[l][m]); } } c } pub fn rdot<const L: usize, const N: usize>(v: [[Torus; N]; L], w: [[Torus; N]; L]) -> [Torus; N] { let mut s: [Torus; N] = [0; N];
rust
height, stride, pixel_size, endianness, } } /// Draws an object that implements the Drawable trait to the buffer pub fn draw<D: Drawable>(&mut self, drawable: &D) { drawable.draw(self); }
rust
Some(right) => Some(Expr::arithmetic_op(right, new_op.unwrap(), expr.clone().unwrap())), None => expr }; }, _ => { self.drop_lexem(); return match right { Some(right) => Ok(Some(Expr::arithmetic_op(left.unwrap(), op.unwrap(), right))), None => Ok(left) }
rust
pub fn find_ancestor<'b, 'p>(base: &'b Path, path: &'p Path) -> Option<&'p Path> { let mut base_components = base.components(); let mut path_components = path.components(); let ancestors = { let mut ancestors = path.ancestors().collect::<Vec<_>>(); ancestors.reverse(); ancestors }; loop { match base_components.next() { Some(Component::Prefix(base_prefix)) => match path_components.next() {
rust
It would also be nice to warn about unreachable states, but the visitor infrastructure for protocols doesn't currently work well for that. */ use ast; use codemap::span; use ext::base::ExtCtxt; use ext::pipes::proto::{state, protocol, next_state}; use ext::pipes::proto; impl proto::visitor<(), (), ()> for @ExtCtxt {
rust
let stacktrace_str_simplified = simplify_stack_trace_str(stacktrace.to_string()); // if panic occurs, first do a simple logging with println!, in case the panic occurred within the logging-system println!("Got panic. @info:{} [see next log-message for stack-trace]", info); error!("Got panic. @info:{}\n@stackTrace:\n==========\n{}", info, stacktrace_str_simplified); std::process::abort(); })); let (mut s1, r1): (ABSender<LogEntry>, ABReceiver<LogEntry>) = async_broadcast::broadcast(10000); s1.set_overflow(true); set_up_logging(s1.clone()); (s1, r1) }
rust
BadAccessTokenEncoding => f.write_str("bad access token encoding"), BadSignedMessageEncoding => f.write_str("bad signed message encoding"), Forbidden => f.write_str("forbidden"), ExpiredAccessToken => f.write_str("expired access token"), Unauthorized => f.write_str("unauthorized"), } } } impl std::error::Error for Error {}
rust
Q: Select, O: Order, { fn write_sql_unchecked(&self, sql: &mut String) { self.stmt.write_sql_unchecked(sql); sql.push_str(" ORDER BY "); self.order.write_order(sql); } }
rust
pub enum LoggerServiceEvent { LogEvent(AsyncEvent), Flush(SyncSender<()>), } pub enum ServiceLoggerImpl { LocalConsole(LocalConsoleLogger), LocalFile(LocalFileLogger), #[cfg(any(feature = "tcp"))] Tcp(TcpLogger),
rust
if pos == self.current { print!(" ({})", marble); } else { print!(" {}", marble); } pos = self.next[pos]; if pos == 0 { break; } } println!(""); } } fn play(info: &Info, factor: usize) {
rust
// } // } pub const SYM_REF_DIR: &str = ".ref"; pub const SYM_PLAYBOOK: &str = ".playbook";
rust
match self { SExp::Float(_) => true, _ => false, } } } impl fmt::Display for SExp { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { use self::SExp::*; match self { List(exprs) => { write!(f, "(")?; let mut sep = ""; for exp in exprs {
rust
// |_ |_ |_| // _| |_| _| // // 6 <-> 5, 8 // // _ _ // |_ |_| // |_| |_| // // 8 <-> 0, 6, 9 //
rust
pub mod row; pub mod wurds_game; /// The maximum number of guesses afforded to the user. pub const MAX_GUESSES: usize = 6; /// Number of letters in the puzzle word (exact, not maximum). pub const WORD_SIZE: usize = 5;
rust
impl Into<SwrEngine> for Engine { fn into(self) -> SwrEngine { match self { Engine::Software => SWR_ENGINE_SWR, Engine::SoundExchange => SWR_ENGINE_SOXR, } } }
rust
match r { Ok(_) => {}, Err(err) => panic!("Error: {}", err) } } fn api_key() -> String { match env::var("SLACK_API_TOKEN") { Ok(val) => val,
rust
#[from(io::Error)] Io(IoError), #[from] StrictEncoding(strict_encoding::Error), /// error in extended key encoding: {0} #[from] XkeyEncoding(slip132::Error), } impl Args { pub fn exec(&self) -> Result<(), Error> {
rust
} split_results } fn report_results(&self, level: &ResponseLevel) -> Vec<ResultsForCapabilityType> { let mut filtered_results = Vec::new(); let split_results = self.split_ok_warn_error_results(); for (type_name, (ok, warnings, errors)) in split_results.into_iter() { let filtered_for_type = match level {
rust
} fn set_datastreams_directory(path: &PathBuf) { let mut lock = DATASTREAMS_DIRECTORY.write().unwrap(); *lock = Some(path.clone().into_boxed_path()); } pub fn valid_source_directory(path: &Path) -> Result<(), String> { fn valid_directory(path: &Path) -> Result<(), String> { if path.is_dir() { Ok(()) } else { Err(format!("The directory '{}' does not exist", path.display())) } }
rust
/// This function can returns one of the following errors: /// * [IoError::Read] if the file with the provided `name` can't be read /// * [IoError::EmptyData] if the file is empty pub fn load(name: &str) -> Result<String> { let config_file = get_config_file(name, true)?; let content = fs::read_to_string(config_file)?; if content.is_empty() { Err(IoError::EmptyData) } else { Ok(content) }
rust
}) } pub fn upload_file( &mut self, local_path: &Path, remote_path: &Path, mode: i32,
rust
#[serde(rename = "unicode-range")] unicode_range: Option<String>, display: Option<String>, style: Option<String>, weight: Option<String>, stretch: Option<String>, } pub(crate) fn escape(s: &str) -> String {
rust
} /// Retrieve a received frame from the specified queue. #[allow(dead_code)] fn get_received_frame_from_queue(&mut self, qid: usize) -> Result<ReceivedFrame, &'static str> { if qid >= self.rx_queues.len() { return Err("Invalid qid"); }
rust
impl Events { /// Constructs an new instance of `Events` with the default config. pub fn new(tick_rate: u64) -> Events { Events::with_config(EventConfig { tick_rate: Duration::from_millis(tick_rate), ..Default::default() }) } /// Constructs an new instance of `Events` from given config. pub fn with_config(config: EventConfig) -> Events { let (tx, rx) = mpsc::channel();
rust
y, SmartcoreKNNRegressorParameters::default() .with_k(settings.knn_regressor_settings.as_ref().unwrap().k) .with_algorithm( settings .knn_regressor_settings .as_ref() .unwrap() .algorithm .clone(), )
rust
x + 1 // expression } fn main() { let tup = (500, 6.4, 1); accept_tup(tup); expression_v_statement(); }
rust
use crate::error::Error; use crate::serde::{Deserialize, Serialize}; use crate::typetag; use crate::DataSource; use std::str; /// this is a dummy data source /// it provides the next item in /// the vector until it is exhausted /// this is mostly useful to supply dummy data /// to logfile structs #[derive(Clone, Serialize, Deserialize)] pub struct InMemoryDataSource { data: Vec<String>, }
rust
attrs!( At::from("fill") => "currentColor", At::from("viewBox") => "0 0 20 20", ), path![attrs!( At::from("d") => "M5 4a1 1 0 00-2 0v7.268a2 2 0 000 3.464V16a1 1 0 102 0v-1.268a2 2 0 000-3.464V4zM11 4a1 1 0 10-2 0v1.268a2 2 0 000 3.464V16a1 1 0 102 0V8.732a2 2 0 000-3.464V4zM16 3a1 1 0 011 1v7.268a2 2 0 010 3.464V16a1 1 0 11-2 0v-1.268a2 2 0 010-3.464V4a1 1 0 011-1z", ),], ]
rust
for s in value.chars() { let u = s as u32; if u < LIMIT_8 {
rust
let parent = parent as windef::HWND; winuser::CreateWindowExW( 0, MAKEINTATOMW(class.0), wchar::wchz!("").as_ptr(), window_type,
rust
m.insert($value.into()); )+ m }} } /// A shorthand notation for `Result<T, SCError>`. pub type SCResult<T> = Result<T, SCError>; /// Indicates that every variant of /// this type has an "opponent". pub trait HasOpponent { /// Fetches the opponent of this variant.
rust
Opcode::ScreenSize => { xous::return_scalar2(msg.sender, 336 as usize, 536 as usize) .expect("GFX: couldn't return ScreenSize request"); } Opcode::QueryGlyphStyle => { xous::return_scalar2( msg.sender, current_glyph.into(), blitstr::glyph_to_height_hint(current_glyph), )
rust
<gh_stars>0 extern crate pyo3; use pyo3::prelude::*; #[pyclass] struct DictionaryFormatter { #[pyo3(get)] name: String, } #[pymethods] impl DictionaryFormatter { #[new] fn new(name: String) -> Self {
rust
} pub fn flush(&mut self) -> Result<()> { self.file.flush()?; self.file.sync_data() } pub fn read_page(&self, id: usize) -> Result<MemoryPage> { let offset = id * PAGE_SIZE; let end = offset + PAGE_SIZE; if end > self.current_size { return invalid_input( if end > self.max_size { format!("invalid page, the specified page is beyond maximum file size (max size = {})", self.max_size)
rust
let disturbance = || { Vector3::new( fastrand::f32() / 20.0, fastrand::f32() / 20.0, fastrand::f32() / 20.0, ) }; Self::World { base_pos: Zero::zero(), base_vel: Zero::zero(),
rust
self.action_num = 21; self.npc_flags.set_ignore_solidity(true); } self.vel_y += if self.y >= self.target_y { -0x10 } else { 0x10 }; self.vel_x += 0x20; self.vel_x = self.vel_x.clamp(-0x600, 0x600);
rust
TimeoutSettingsIdle: DWORD, DeviceClientDrives: DWORD, DeviceClientPrinters: DWORD, ClientDefaultPrinter: DWORD, BrokenTimeoutSettings: DWORD, ReconnectSettings: DWORD, ShadowingSettings: DWORD, TerminalServerRemoteHomeDir: DWORD, InitialProgram: [CHAR; MAX_PATH + 1], WorkDirectory: [CHAR; MAX_PATH + 1], TerminalServerProfilePath: [CHAR; MAX_PATH + 1], TerminalServerHomeDir: [CHAR; MAX_PATH + 1], TerminalServerHomeDirDrive: [CHAR; WTS_DRIVE_LENGTH + 1], }}
rust
assert_emscripten_output!( "../../emtests/test_strstr.wasm", "test_strstr", vec![], "../../emtests/test_strstr.out" ); }
rust
/// `parse_gid_uid_and_filter` will be called to obtain the target gid and uid, and the filter, /// from `ArgMatches`. /// `groups_only` determines whether verbose output will only mention the group. pub fn chown_base<'a>( mut app: App<'a, 'a>, args: impl crate::Args, add_arg_if_not_reference: &'a str, parse_gid_uid_and_filter: GidUidFilterParser<'a>, groups_only: bool,