content stringlengths 12 392k | id int64 0 1.08k |
|---|---|
unsafe
fn
atomic_compare_exchange_weak
<
T
>
(
dst
:
*
mut
T
mut
current
:
T
new
:
T
)
-
>
Result
<
T
T
>
where
T
:
Copy
+
Eq
{
atomic
!
{
T
a
{
a
=
&
*
(
dst
as
*
const
_
as
*
const
_
)
;
let
mut
current_raw
=
mem
:
:
transmute_copy
(
&
current
)
;
let
new_raw
=
mem
:
:
transmute_copy
(
&
new
)
;
loop
{
match
a
.
comp... | 100 |
pub extern "x86-interrupt" fn double_fault() { CommonExceptionHandler( 8); } | 101 |
pub fn test_op_rvc_srai_crash_32() {
let buffer = fs::read("tests/programs/op_rvc_srai_crash_32")
.unwrap()
.into();
let result = run::<u32, SparseMemory<u32>>(&buffer, &vec!["op_rvc_srai_crash_32".into()]);
assert!(result.is_ok());
} | 102 |
fn file_age(path:&Path) -> Result<time::Duration> {
let metadata = try!(fs::metadata(path));
let accessed = try!(metadata.accessed());
Ok(try!(accessed.elapsed()))
} | 103 |
fn from_command_line() {
let config_file = env::args().nth(1).expect("config file");
println!("config file: {}", config_file);
let mut file = File::open(config_file).expect("Unable to open config file");
let mut contents = String::new();
file.read_to_string(&mut contents)
.expect("Unable to... | 104 |
fn build_user(email: String, username: String) -> User{
User{
// Using the Field Init Shorthand when Variables and Fields Have the Same Name
email,
username,
active: true,
sign_in_count: 1
}
} | 105 |
fn show(store: &MemoryStore) -> String {
let mut writer = std::io::Cursor::new(Vec::<u8>::new());
store
.dump_dataset(&mut writer, DatasetFormat::NQuads)
.unwrap();
String::from_utf8(writer.into_inner()).unwrap()
} | 106 |
pub fn task_set_cpool(target: CAddr, cpool: CAddr) {
system_call(SystemCall::TaskSetCPool {
request: (target, cpool),
});
} | 107 |
fn generate_binaries_data(settings: &Settings) -> crate::Result<Vec<Binary>> {
let mut binaries = Vec::new();
let regex = Regex::new(r"[^\w\d\.]")?;
let cwd = std::env::current_dir()?;
for src in settings.external_binaries() {
let src = src?;
let filename = src
.file_name()
.expect("failed t... | 108 |
fn bench_micro(c: &mut Criterion, bench_name: &'static str) {
let mut group = c.benchmark_group(format!("{}/{}", bench_name, "micro"));
// https://github.com/timberio/vector/runs/1746002475
group.noise_threshold(0.05);
group.bench_function("bare_counter", |b| {
b.iter(|| {
counter!("... | 109 |
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()
} | 110 |
pub(super) fn lint<'tcx>(
cx: &LateContext<'tcx>,
expr: &'tcx hir::Expr<'_>,
args: &'tcx [hir::Expr<'_>],
allow_variant_calls: bool,
simplify_using: &str,
) {
let is_option = is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(&args[0]), sym!(option_type));
let is_result = is_type_diagno... | 111 |
fn main() {
let mut game = Session::new("Hello World", 5);
match game.guess('c') {
Err(e) => std::panic::panic_any(e),
Ok(_) => {}
};
game.test_display();
} | 112 |
fn test_invalid_variable_5() {
let parsed_data =
common::get_file_content_parsed(PARENT_FOLDER, "invalid_variable_with_object.ura");
assert!(parsed_data
.unwrap_err()
.downcast_ref::<ParseError>()
.is_some());
} | 113 |
pub fn test_misaligned_jump64() {
let buffer = fs::read("tests/programs/misaligned_jump64").unwrap().into();
let result = run::<u64, SparseMemory<u64>>(&buffer, &vec!["misaligned_jump64".into()]);
assert!(result.is_ok());
} | 114 |
fn main() {
dotenv::dotenv().ok();
env_logger::init();
let config = config::config_from_environment().expect("Can't load configuration.");
debug!("{:?}", &config);
let system = actix::System::new("Translator");
/*
let storer = database::TradeHistoryStorer::new(config.database_url());
l... | 115 |
pub fn sobel_optimized(frame : ImageBuffer<Luma<u8>, Vec<u8>>) -> ImageBuffer<Luma<u8>, Vec<u8>> {
let mut result = ImageBuffer::new(640, 480);
let mut i = 1;
while i < 638 {
let mut j = 1;
while j < 479 {
let north_west = frame[(i-1, j-1)].channels()[0] as i32;
let... | 116 |
pub const fn create_default_audio_stream(stream_type: AudioStreamType) -> AudioStream {
AudioStream {
stream_type: stream_type,
source: AudioSettingSource::User,
user_volume_level: DEFAULT_VOLUME_LEVEL,
user_volume_muted: DEFAULT_VOLUME_MUTED,
}
} | 117 |
pub fn dat_op(_inputs: OpInputs) -> EmulatorResult<()> {
// Do nothing past operand evaluation
// Queue no further values to the process queue
Ok(())
} | 118 |
fn list() {
let project = project("add").with_fuzz().build();
// Create some targets.
project.cargo_fuzz().arg("add").arg("c").assert().success();
project.cargo_fuzz().arg("add").arg("b").assert().success();
project.cargo_fuzz().arg("add").arg("a").assert().success();
// Make sure that we can ... | 119 |
fn parse_prefix_command(rom: &[u8]) -> Option<Box<dyn Instruction>> {
let opcode = rom[0];
match opcode {
/* RLC r */
0x00...0x07 => unimplemented!("RLC r"),
/* RRC r */
0x08...0x0F => unimplemented!("RRC r"),
/* RL B */
0x10 => cmd!(alu::RotateRegisterLeft(r8!(B)... | 120 |
pub fn fill_buffer_default<T: Default> (b: &mut [T]) {
fill_buffer_with(b, T::default)
} | 121 |
pub fn ranged_attack(
ecs: &mut World,
map: &mut Map,
attacker: Entity,
victim: Entity,
ranged_power: i32,
) {
let mut attacker_pos = None;
let mut victim_pos = None;
// Find positions for the start and end
if let Ok(ae) = ecs.entry_ref(attacker) {
if let Ok(pos) = ae.get_co... | 122 |
fn check_layout(layout: Layout) -> Result<(), AllocErr> {
if layout.size() > LARGEST_POWER_OF_TWO {
return Err(AllocErr::Unsupported { details: "Bigger than largest power of two" });
}
debug_assert!(layout.size() > 0);
Ok(())
} | 123 |
fn update(path: &Path, contents: &str, mode: Mode) -> Result<()> {
match fs2::read_to_string(path) {
Ok(ref old_contents) if normalize(old_contents) == normalize(contents) => {
return Ok(());
}
_ => (),
}
if mode == Mode::Verify {
anyhow::bail!("`{}` is not up-to-... | 124 |
pub fn success() {
exit_qemu(0x10);
} | 125 |
async fn main() -> tide::Result<()> {
let contents = get_config("~/data/british-english").await?;
let mut app = tide::new();
app.at("/orders/shoes").post(order_shoes);
app.listen("127.0.0.1:8080").await?;
Ok(())
} | 126 |
fn ident(url: &Url) -> String {
let url = canonicalize_url(url);
let ident = url.path_segments().and_then(|mut s| s.next_back()).unwrap_or("");
let ident = if ident == "" { "_empty" } else { ident };
format!("{}-{}", ident, short_hash(&url))
} | 127 |
pub fn charset(charset: &CharsetType) -> Vec<char> {
match charset {
CharsetType::Lowercase => {
"abcdefghijklmnopqrstuvwxyz".chars().collect()
},
CharsetType::Uppercase => {
"ABCDEFGHIJKLMNQRSTUVWXYZ".chars().collect()
},
CharsetType::Symbols => {
... | 128 |
fn read_chars() -> Vec<char> {
let stdin = stdin();
let mut buf = String::new();
let _bytes = stdin.read_line(&mut buf).unwrap();
return buf.trim().chars().collect();
} | 129 |
fn yield_spin_loop(use_yield: bool) {
const NUM_THREADS: usize = 4;
let scheduler = PctScheduler::new(1, 100);
let mut config = Config::new();
config.max_steps = MaxSteps::FailAfter(50);
let runner = Runner::new(scheduler, config);
runner.run(move || {
let count = Arc::new(AtomicUsize::... | 130 |
pub(crate) fn run(args: &ArgMatches) -> AppResult<()> {
let tap_info = create_tap()?;
let data_sock = create_data_sock()?;
let is_auto = args.is_present("auto");
// init peers from args
let init_peers = match args.value_of("peers") {
Some(peers_str) => parse_peers_str(peers_str)?,
N... | 131 |
fn position_to_pos(file: &SourceFile, pos: &protocol::Position) -> Pos {
if let Some(mut span) = file.line_spans().nth(pos.line as usize) {
let begin = span.begin().to_usize();
let end = span.end().to_usize();
let mut k = pos.character as usize;
match file.data() {
Sourc... | 132 |
pub fn challenge_3() {
let input = hex::decode("1b37373331363f78151b7f2b783431333d78397828372d363c78373e783a393b3736").unwrap();
let (key, conf) = crypto::find_single_xor(&input);
println!("{} {} {}", key, String::from_utf8(crypto::xor_repeating(&input, &vec![key])).unwrap(), conf);
} | 133 |
pub fn write_str<W>(wr: &mut W, data: &str) -> Result<(), ValueWriteError>
where W: Write
{
try!(write_str_len(wr, data.len() as u32));
wr.write_all(data.as_bytes()).map_err(|err| ValueWriteError::InvalidDataWrite(WriteError(err)))
} | 134 |
pub fn compstmt(nodes: Node) -> Node {
if let Node::Nodes(extracted_nodes) = nodes {
match extracted_nodes.len() {
0 => { return Node::Null; }
1 => { return extracted_nodes.get(0).unwrap().clone(); }
// TODO collection_map
_ => { return Node::Begin(extracted_n... | 135 |
fn test_normal() {
let parsed_data = common::get_file_content_parsed(PARENT_FOLDER, "normal.ura").unwrap();
assert_eq!(parsed_data, get_expected());
} | 136 |
pub fn test_outofcycles_in_syscall() {
let buffer = fs::read("tests/programs/syscall64").unwrap().into();
let core_machine = DefaultCoreMachine::<u64, SparseMemory<u64>>::new(ISA_IMC, VERSION0, 20);
let mut machine = DefaultMachineBuilder::new(core_machine)
.instruction_cycle_func(Box::new(constant_... | 137 |
pub fn fail() {
exit_qemu(0x11);
} | 138 |
fn test_dec_bin_compat<D, I>(dec: D, expected_dec: &[u16], expected_comp: I)
where
D: Fn(I) -> Option<Vec<u16>>,
{
let decompressed = dec(expected_comp).expect("Valid Decompress");
assert_eq!(decompressed, expected_dec);
} | 139 |
pub extern "x86-interrupt" fn ISR41() { CommonInterruptHandler(41); } | 140 |
pub fn check_board(board: &str) -> bool {
let board = Board::from_str(board);
if let Ok(board) = board {
is_board_valid(&board)
}
else {
false
}
} | 141 |
pub fn write_uint64(buf: &mut Vec<u8>, u: u64) -> usize {
let mut size = 0;
size += write_uint32(buf, (u & 0xffffffff) as u32);
size += write_uint32(buf, ((u >> 32) & 0xffffffff) as u32);
size
} | 142 |
fn cmin() {
let corpus = Path::new("fuzz").join("corpus").join("foo");
let project = project("cmin")
.with_fuzz()
.fuzz_target(
"foo",
r#"
#![no_main]
use libfuzzer_sys::fuzz_target;
fuzz_target!(|data: &[u8]| {
... | 143 |
fn parse_aliases(attributes: &[Attribute]) -> Option<Punctuated<AliasSchema, Comma>> {
attributes
.iter()
.find(|attribute| attribute.path().is_ident("aliases"))
.map(|aliases| {
aliases
.parse_args_with(Punctuated::<AliasSchema, Comma>::parse_terminated)
... | 144 |
pub async fn client_async_with_config<'a, R, S>(
request: R,
stream: S,
config: Option<WebSocketConfig>,
) -> Result<(WebSocketStream<TokioAdapter<S>>, Response), Error>
where
R: IntoClientRequest + Unpin,
S: tokio::io::AsyncRead + tokio::io::AsyncWrite + Unpin,
{
crate::client_async_with_config... | 145 |
fn pool() -> &'static Pool<ConnectionManager<PgConnection>> {
POOL.get_or_init(|| {
dotenv().ok();
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
let manager = ConnectionManager::<PgConnection>::new(database_url);
Pool::builder()
.max_s... | 146 |
pub fn store(write: &Writer, path: &Path, data_path: &Path) {
let mut files = Vec::new();
for e in WalkDir::new(path).into_iter().filter_map(|e| e.ok()) {
if e.metadata().unwrap().is_file() {
let path = e.path();
let extension = path.extension().unwrap();
if extension... | 147 |
fn parseFromFile(file: &File) {
let mut reader = BufReader::new(file);
let mut buf = String::from("");
let line_index = 0;
let mut models: Vec<Model> = Vec::new();
let mut lights: Vec<Model> = Vec::new();
while (reader.read_line(&mut buf) != 0) {
if lien_index == 0 {
... | 148 |
pub fn hex_to_vec(hex: &str) -> Option<Vec<u8>> {
let mut out = Vec::with_capacity(hex.len() / 2);
let mut b = 0;
for (idx, c) in hex.as_bytes().iter().enumerate() {
b <<= 4;
match *c {
b'A'..=b'F' => b |= c - b'A' + 10,
b'a'..=b'f' => b |= c - b'a' + 10,
b'0'..=b'9' => b |= c - b'0',
_ => return No... | 149 |
fn broker(table: &mut Table, ntransfers: u32) {
let mut rng = thread_rng();
let mut ract = Range::new(0, 100);
let mut ramt = Range::new(0, 1000);
let mut nstale = 0;
for _ in 0..ntransfers {
let a1 = ract.sample(&mut rng);
let mut a2 = ract.sample(&mut rng);
while a2 == a1 {
a2 = ract.sam... | 150 |
pub async fn run(host: Arc<String>) -> Result<HashSet<String>> {
let mut tasks = Vec::new();
let mut results: HashSet<String> = HashSet::new();
let resp = next_page(&host, None).await;
// insert subdomains from first page.
resp.subdomains()
.into_iter()
.map(|s| results.insert(s))
... | 151 |
fn inc_25() {
run_test(&Instruction { mnemonic: Mnemonic::INC, operand1: Some(Direct(RSI)), operand2: None, operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[72, 255, 198], OperandSize::Qword)
} | 152 |
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,
... | 153 |
pub fn debug_test_fail() {
system_call(SystemCall::DebugTestFail);
loop {}
} | 154 |
fn assemble(path: String) -> std::io::Result<()> {
let mem = assembler::parse_file(&path)?;
let out_path = path.replace(".tat", ".rom");
mem.save_program(&out_path)?;
mem.print_program();
Ok(())
} | 155 |
async fn save_metric_entry(mut database: &Database, hostname: &str, timestamp: &DateTime<Utc>, entry: DockerContainerMetricEntry) -> Result<(), MetricSaveError> {
sqlx::query!(
"insert into metric_docker_containers (hostname, timestamp, name, state, cpu_usage, memory_usage, memory_cache, network_tx, network... | 156 |
fn loadImageFromMaterial(model: &mut Model, materialPath: &str) {
model.albedo_map = materialPath + "_albedo.png";
model.normal_map = materialPath + "_normal.png";
model.ambient_ligth = materialPath + "_ao.png";
model.roughness_map = materialPath + "_rough.png"
} | 157 |
fn main() {
let matches = App::new(crate_name!())
.version(crate_version!())
.about("build git branches from merge requests")
.template(TEMPLATE)
.arg(
Arg::with_name("config")
.short("c")
.long("config")
.value_name("FILE")
.required(true)
.help("config f... | 158 |
pub fn alignment_size(desired: usize) -> usize {
desired + (BLOCK_SIZE - PAGE_SIZE)
} | 159 |
pub fn write_nil<W>(wr: &mut W) -> Result<(), FixedValueWriteError>
where W: Write
{
write_fixval(wr, Marker::Null)
} | 160 |
pub fn assert_variadic_arguments<D: Display>(
name: D,
actual: usize,
expected: (usize, usize),
) -> Result<()> {
if actual < expected.0 || actual > expected.1 {
return Err(ErrorCode::NumberArgumentsNotMatch(format!(
"{} expect to have [{}, {}] arguments, but got {}",
nam... | 161 |
fn config() -> Criterion {
let mut c = Criterion::default();
c.without_plots();
c
} | 162 |
fn add() {
let project = project("add").with_fuzz().build();
project
.cargo_fuzz()
.arg("add")
.arg("new_fuzz_target")
.assert()
.success();
assert!(project.fuzz_target_path("new_fuzz_target").is_file());
assert!(project.fuzz_cargo_toml().is_file());
let carg... | 163 |
pub fn jmp_op(inputs: OpInputs) -> EmulatorResult<()> {
// jmp unconditionally adds the b pointer to the process queue
inputs.pq.push_back(inputs.regs.a.idx, inputs.warrior_id)?;
Ok(())
} | 164 |
pub fn challenge_6() {
let mut file = File::open("data/6good.txt").unwrap();
let mut all_file = String::new();
file.read_to_string(&mut all_file).unwrap();
let data = base64::decode(&all_file).unwrap();
let key = crypto::break_xor(&data);
let cleartext = crypto::xor_repeating(&data, &key);
l... | 165 |
pub fn make_buffer_default<T: Default> (len: usize) -> Box<[T]> {
make_buffer_with(len, T::default)
} | 166 |
fn no_plots(c: &mut Criterion) {
c.bench_function("dummy", |b| b.iter(|| {10}));
let has_svg = !WalkDir::new(".criterion/dummy").into_iter().any(|entry| {
let entry = entry.ok();
entry
.as_ref()
.and_then(|entry| entry.path().extension())
.and_then(|ext| ext.... | 167 |
pub fn debug_test_succeed() {
system_call(SystemCall::DebugTestSucceed);
loop {}
} | 168 |
async fn get_config(path: &str) -> Result<String, Error> {
fs::read_to_string(path).await
} | 169 |
fn test_invalid_variable_3() {
let parsed_data = parse(&"$invalid: null");
assert!(parsed_data
.unwrap_err()
.downcast_ref::<ParseError>()
.is_some());
} | 170 |
pub fn clamp<T: Ord> (x: T, a: T, b: T) -> T {
match (x.cmp(&a), x.cmp(&b)) {
(Ordering::Less, _) => a,
(_, Ordering::Greater) => b,
_ => x,
}
} | 171 |
pub async fn handle_command(ctx: Arc<Context>, mut command: InteractionCommand) {
let name = mem::take(&mut command.data.name);
EventKind::InteractionCommand
.log(&ctx, &command, &name)
.await;
let Some(cmd) = InteractionCommands::get().command(&name) else {
return error!(name, "Unk... | 172 |
pub fn open_devtools(window: Window) {
window.open_devtools()
} | 173 |
fn cargo_fuzz() -> Command {
Command::cargo_bin("cargo-fuzz").unwrap()
} | 174 |
pub fn write_slice(buf: &mut Vec<u8>, u: &[u8]) -> usize {
buf.extend_from_slice(u);
u.len()
} | 175 |
fn read_private_key(path: &str) -> Result<rustls::PrivateKey, String> {
let key_pem = match fs::File::open(path) {
Ok(v) => v,
Err(err) => return Err(err.to_string()),
};
let mut reader = io::BufReader::new(key_pem);
let keys = match rustls::internal::pemfile::rsa_private_keys(&mut rea... | 176 |
fn is_aligned(value: usize, alignment: usize) -> bool {
(value & (alignment - 1)) == 0
} | 177 |
pub fn i_le8(x: u64, y: u64) -> u64 {
(((y | H8) - (x & !H8)) ^ x ^ y) & H8
} | 178 |
pub fn run() {
let rules = BufReader::new(File::open("d21_input.txt").unwrap()).lines().filter_map(|l| l.ok())
.flat_map(|l| to_rules(&l).into_iter())
.collect::<HashMap<_, _>>();
let init = Matrix::square_from_vec(vec![false, true, false, false, false, true, true, true, true]);
// todo use... | 179 |
fn main() {
println!("Hello, friend!");
// ARRAYS
// ======
// Declare arrays
let a1 = [1, 2, 3]; // a1: [i32; 3]
let a2 = [1, 2, 3, 4]; // a2: [i32; 4]
let a3 = [0; 20]; // a3: [i32; 20] declare a array with 20 elements and all initilized with 0
// Get the length of the array
... | 180 |
fn main() {
let input1 = vec![1,2,5];
let sol = Solution::coin_change(input1, 11);
println!("Result: {}, Expected: 3", sol);
} | 181 |
fn bench(f: fn()) {
let t0 = time::Instant::now();
let ret = f();
println!("time used {:?}", time::Instant::now().duration_since(t0));
ret
} | 182 |
pub fn write_varuint7(buf: &mut Vec<u8>, u: u8) -> usize {
write_uint8(buf, u)
} | 183 |
fn can_simplify(expr: &hir::Expr<'_>, params: &[hir::Param<'_>], variant_calls: bool) -> bool {
match expr.kind {
// Closures returning literals can be unconditionally simplified
hir::ExprKind::Lit(_) => true,
hir::ExprKind::Index(ref object, ref index) => {
// arguments are not... | 184 |
fn inc_18() {
run_test(&Instruction { mnemonic: Mnemonic::INC, operand1: Some(IndirectScaledDisplaced(RSI, Eight, 498480708, Some(OperandSize::Word), None)), operand2: None, operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[102, 255, 4, ... | 185 |
fn main() {
// Initialize the environment logger only once.
// This should be the first thing to happen.
if let Err(e) = env_logger::init() {
error!("Failed to initialise environment logger because {}", e);
}
const VERSION: Option<&'static str> = option_env!("CARGO_PKG_VERSION");
const ... | 186 |
fn main() {
let name = std::env::args().nth(1).unwrap();
let _ = std::fs::remove_dir_all(format!("tests/data/fixtures/{name}"));
std::fs::create_dir_all(format!("tests/data/fixtures/{name}")).unwrap();
let inputs =
std::fs::File::open(format!("tests/data/fixtures/{name}.in"))
.unwra... | 187 |
pub fn retype_cpool(source: CAddr, target: CAddr) {
system_call(SystemCall::RetypeCPool {
request: (source, target),
});
} | 188 |
pub fn decode(codepoint: u16) -> Option<char> {
match codepoint {
0x2121 => Some(unsafe { transmute(0x3000u32) }),
0x2122 => Some(unsafe { transmute(0x3001u32) }),
0x2123 => Some(unsafe { transmute(0x3002u32) }),
0x2124 => Some(unsafe { transmute(0xff0cu32) }),
0x2125 => Some... | 189 |
pub fn get_cpu_utilization() -> f64 {
use std::env;
env::var("BELLMAN_CPU_UTILIZATION")
.and_then(|v| match v.parse() {
Ok(val) => Ok(val),
Err(_) => {
error!("Invalid BELLMAN_CPU_UTILIZATION! Defaulting to 0...");
Ok(0f64)
}
})... | 190 |
fn parse_peers_str(peers_str: &str) -> AppResult<Vec<Peer>> {
let peers_str: Vec<&str> = peers_str.split(",").collect();
let peers: Vec<Peer> = peers_str
.into_iter()
.map(|it| {
let peer = it.parse();
peer.unwrap()
})
.collect();
Ok(peers)
} | 191 |
pub fn semaphore() -> &'static Semaphore {
SEMAPHORE.get_or_init(|| Semaphore::new(*pool_connection_number()))
} | 192 |
extern fn QScroller_scrollerPropertiesChanged_signal_connect_cb_0(rsfptr:fn(QScrollerProperties), arg0: *mut c_void) {
println!("{}:{}", file!(), line!());
let rsarg0 = QScrollerProperties::inheritFrom(arg0 as u64);
rsfptr(rsarg0);
} | 193 |
fn main() -> ! {
let p = stm32::Peripherals::take().unwrap();
let gpio_a = p.GPIOA.split();
let btn_a = gpio_a.pa4.into_pull_up_input();
let btn_b = gpio_a.pa10.into_pull_up_input();
let gpio_b = p.GPIOB.split();
let gpio_c = p.GPIOC.split();
let mut r = gpio_b.pb4.into_push_pull_output();
... | 194 |
fn enhance(old: &Matrix<bool>, rules: &HashMap<Matrix<bool>, Matrix<bool>>) -> Matrix<bool> {
if old.rows % 2 == 0 {
let old_chunks = old.rows / 2;
let new_grid_size = old_chunks * 3;
let mut new_grid = Matrix::new_square(new_grid_size, false);
for chunk_y in 0..old_chunks {
... | 195 |
pub fn write_varint7(buf: &mut Vec<u8>, i: i8) -> usize {
write_uint8(buf, (i as u8) ^ 0x80)
} | 196 |
unsafe fn near_heap_ultimate_root_ptr<T, F: Fn(&T, &T) -> bool>(mut root: *mut T, order: usize, f: F) -> *mut T {
if order > 1 { for &child_root in &[root.offset(-(leo.get_unchecked(order - 2) + 1)), root.offset(-1)] {
if f(&*root, &*child_root) { root = child_root; }
} }
root
} | 197 |
fn draw_body<Message, B>(
renderer: &mut Renderer<B>,
body: &Element<'_, Message, Renderer<B>>,
layout: Layout<'_>,
cursor_position: Point,
viewport: &Rectangle,
style: &Style,
) -> (Primitive, mouse::Interaction)
where
B: Backend + backend::Text,
{
let mut body_children = layout.childre... | 198 |
fn main() {
module4::blah::doit();
foo_();
let _ = Bar;
} | 199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.