repo
stringlengths
6
65
file_url
stringlengths
81
311
file_path
stringlengths
6
227
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:31:58
2026-01-04 20:25:31
truncated
bool
2 classes
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-utils/build.rs
crossbeam-utils/build.rs
// The rustc-cfg listed below are considered public API, but it is *unstable* // and outside of the normal semver guarantees: // // - `crossbeam_no_atomic` // Assume the target does *not* support any atomic operations. // This is usually detected automatically by the build script, but you may // need to ...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-utils/no_atomic.rs
crossbeam-utils/no_atomic.rs
// This file is @generated by no_atomic.sh. // It is not intended for manual editing. const NO_ATOMIC: &[&str] = &[ "bpfeb-unknown-none", "bpfel-unknown-none", "mipsel-sony-psx", "msp430-none-elf", ];
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-utils/src/backoff.rs
crossbeam-utils/src/backoff.rs
use crate::primitive::hint; use core::cell::Cell; use core::fmt; const SPIN_LIMIT: u32 = 6; const YIELD_LIMIT: u32 = 10; /// Performs exponential backoff in spin loops. /// /// Backing off in spin loops reduces contention and improves overall performance. /// /// This primitive can execute *YIELD* and *PAUSE* instruc...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-utils/src/lib.rs
crossbeam-utils/src/lib.rs
//! Miscellaneous tools for concurrent programming. //! //! ## Atomics //! //! * [`AtomicCell`], a thread-safe mutable memory location. //! * [`AtomicConsume`], for reading from primitive atomic types with "consume" ordering. //! //! ## Thread synchronization //! //! * [`Parker`], a thread parking primitive. //! * [`Sh...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-utils/src/cache_padded.rs
crossbeam-utils/src/cache_padded.rs
use core::fmt; use core::ops::{Deref, DerefMut}; /// Pads and aligns a value to the length of a cache line. /// /// In concurrent programming, sometimes it is desirable to make sure commonly accessed pieces of /// data are not placed into the same cache line. Updating an atomic value invalidates the whole /// cache li...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-utils/src/thread.rs
crossbeam-utils/src/thread.rs
//! Threads that can borrow variables from the stack. //! //! Create a scope when spawned threads need to access variables on the stack: //! //! ``` //! use crossbeam_utils::thread; //! //! let people = vec![ //! "Alice".to_string(), //! "Bob".to_string(), //! "Carol".to_string(), //! ]; //! //! thread::sco...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-utils/src/atomic/seq_lock.rs
crossbeam-utils/src/atomic/seq_lock.rs
use core::mem; use core::sync::atomic::{self, AtomicUsize, Ordering}; use crate::Backoff; /// A simple stamped lock. pub(crate) struct SeqLock { /// The current state of the lock. /// /// All bits except the least significant one hold the current stamp. When locked, the state /// equals 1 and doesn't ...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-utils/src/atomic/mod.rs
crossbeam-utils/src/atomic/mod.rs
//! Atomic types. //! //! * [`AtomicCell`], a thread-safe mutable memory location. //! * [`AtomicConsume`], for reading from primitive atomic types with "consume" ordering. #[cfg(target_has_atomic = "ptr")] #[cfg(not(crossbeam_loom))] // Use "wide" sequence lock if the pointer width <= 32 for preventing its counter ag...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-utils/src/atomic/atomic_cell.rs
crossbeam-utils/src/atomic/atomic_cell.rs
// Necessary for implementing atomic methods for `AtomicUnit` #![allow(clippy::unit_arg)] use crate::primitive::sync::atomic::{self, Ordering}; use crate::CachePadded; use core::cell::UnsafeCell; use core::cmp; use core::fmt; use core::mem::{self, ManuallyDrop, MaybeUninit}; use core::panic::{RefUnwindSafe, UnwindSafe...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
true
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-utils/src/atomic/seq_lock_wide.rs
crossbeam-utils/src/atomic/seq_lock_wide.rs
use core::mem; use core::sync::atomic::{self, AtomicUsize, Ordering}; use crate::Backoff; /// A simple stamped lock. /// /// The state is represented as two `AtomicUsize`: `state_hi` for high bits and `state_lo` for low /// bits. pub(crate) struct SeqLock { /// The high bits of the current state of the lock. ...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-utils/src/atomic/consume.rs
crossbeam-utils/src/atomic/consume.rs
#[cfg(not(crossbeam_no_atomic))] use core::sync::atomic::Ordering; /// Trait which allows reading from primitive atomic types with "consume" ordering. pub trait AtomicConsume { /// Type returned by `load_consume`. type Val; /// Loads a value from the atomic using a "consume" memory ordering. /// /...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-utils/src/sync/parker.rs
crossbeam-utils/src/sync/parker.rs
use crate::primitive::sync::atomic::{AtomicUsize, Ordering::SeqCst}; use crate::primitive::sync::{Arc, Condvar, Mutex}; use std::fmt; use std::marker::PhantomData; use std::time::{Duration, Instant}; /// A thread parking primitive. /// /// Conceptually, each `Parker` has an associated token which is initially not pres...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-utils/src/sync/wait_group.rs
crossbeam-utils/src/sync/wait_group.rs
use crate::primitive::sync::{Arc, Condvar, Mutex}; use std::fmt; /// Enables threads to synchronize the beginning or end of some computation. /// /// # Wait groups vs barriers /// /// `WaitGroup` is very similar to [`Barrier`], but there are a few differences: /// /// * [`Barrier`] needs to know the number of threads ...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-utils/src/sync/once_lock.rs
crossbeam-utils/src/sync/once_lock.rs
// Based on unstable std::sync::OnceLock. // // Source: https://github.com/rust-lang/rust/blob/8e9c93df464b7ada3fc7a1c8ccddd9dcb24ee0a0/library/std/src/sync/once_lock.rs use core::cell::UnsafeCell; use core::mem::MaybeUninit; use std::sync::Once; pub(crate) struct OnceLock<T> { once: Once, value: UnsafeCell<M...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-utils/src/sync/mod.rs
crossbeam-utils/src/sync/mod.rs
//! Thread synchronization primitives. //! //! * [`Parker`], a thread parking primitive. //! * [`ShardedLock`], a sharded reader-writer lock with fast concurrent reads. //! * [`WaitGroup`], for synchronizing the beginning or end of some computation. #[cfg(not(crossbeam_loom))] mod once_lock; mod parker; #[cfg(not(cros...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-utils/src/sync/sharded_lock.rs
crossbeam-utils/src/sync/sharded_lock.rs
use std::boxed::Box; use std::cell::UnsafeCell; use std::collections::HashMap; use std::fmt; use std::marker::PhantomData; use std::mem; use std::ops::{Deref, DerefMut}; use std::panic::{RefUnwindSafe, UnwindSafe}; use std::sync::{LockResult, PoisonError, TryLockError, TryLockResult}; use std::sync::{Mutex, RwLock, RwL...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-utils/tests/parker.rs
crossbeam-utils/tests/parker.rs
use std::thread::sleep; use std::time::Duration; use crossbeam_utils::sync::{Parker, UnparkReason}; use crossbeam_utils::thread; #[test] fn park_timeout_unpark_before() { let p = Parker::new(); for _ in 0..10 { p.unparker().unpark(); assert_eq!( p.park_timeout(Duration::from_millis...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-utils/tests/wait_group.rs
crossbeam-utils/tests/wait_group.rs
use std::sync::mpsc; use std::thread; use std::time::Duration; use crossbeam_utils::sync::WaitGroup; const THREADS: usize = 10; #[test] fn wait() { let wg = WaitGroup::new(); let (tx, rx) = mpsc::channel(); for _ in 0..THREADS { let wg = wg.clone(); let tx = tx.clone(); thread::...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-utils/tests/cache_padded.rs
crossbeam-utils/tests/cache_padded.rs
use std::cell::Cell; use std::mem; use crossbeam_utils::CachePadded; #[test] fn default() { let x: CachePadded<u64> = Default::default(); assert_eq!(*x, 0); } #[test] fn store_u64() { let x: CachePadded<u64> = CachePadded::new(17); assert_eq!(*x, 17); } #[test] fn store_pair() { let x: CachePadd...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-utils/tests/sharded_lock.rs
crossbeam-utils/tests/sharded_lock.rs
use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::mpsc::channel; use std::sync::{Arc, TryLockError}; use std::thread; use crossbeam_utils::sync::ShardedLock; #[derive(Eq, PartialEq, Debug)] struct NonCopy(i32); #[test] fn smoke() { let l = ShardedLock::new(()); drop(l.read().unwrap()); drop(...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-utils/tests/atomic_cell.rs
crossbeam-utils/tests/atomic_cell.rs
use std::mem; use std::sync::atomic::AtomicUsize; use std::sync::atomic::Ordering::SeqCst; use crossbeam_utils::atomic::AtomicCell; // Always use fallback for now on environments that do not support inline assembly. fn always_use_fallback() -> bool { atomic_maybe_uninit::cfg_has_atomic_cas! { cfg!(any( ...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-utils/tests/thread.rs
crossbeam-utils/tests/thread.rs
use std::any::Any; use std::sync::atomic::{AtomicUsize, Ordering}; use std::thread::sleep; use std::time::Duration; use crossbeam_utils::thread; const THREADS: usize = 10; const SMALL_STACK_SIZE: usize = 20; #[test] fn join() { let counter = AtomicUsize::new(0); thread::scope(|scope| { let handle = s...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-utils/benches/atomic_cell.rs
crossbeam-utils/benches/atomic_cell.rs
#![feature(test)] extern crate test; use std::sync::Barrier; use crossbeam_utils::atomic::AtomicCell; use crossbeam_utils::thread; #[bench] fn load_u8(b: &mut test::Bencher) { let a = AtomicCell::new(0u8); let mut sum = 0; b.iter(|| sum += a.load()); test::black_box(sum); } #[bench] fn store_u8(b: ...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/benchmarks/mpsc.rs
crossbeam-channel/benchmarks/mpsc.rs
use std::sync::mpsc; mod message; const MESSAGES: usize = 5_000_000; const THREADS: usize = 4; pub fn shuffle<T>(v: &mut [T]) { use std::cell::Cell; use std::num::Wrapping; let len = v.len(); if len <= 1 { return; } thread_local! { static RNG: Cell<Wrapping<u32>> = const { C...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/benchmarks/lockfree.rs
crossbeam-channel/benchmarks/lockfree.rs
use lockfree::channel; mod message; const MESSAGES: usize = 5_000_000; const THREADS: usize = 4; use std::thread; fn seq() { let (mut tx, mut rx) = channel::spsc::create(); for i in 0..MESSAGES { tx.send(message::new(i)).unwrap(); } for _ in 0..MESSAGES { while rx.recv().is_err() {...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/benchmarks/mpmc.rs
crossbeam-channel/benchmarks/mpmc.rs
use std::thread; mod message; const MESSAGES: usize = 5_000_000; const THREADS: usize = 4; fn seq(cap: usize) { let q = mpmc::Queue::with_capacity(cap); for i in 0..MESSAGES { loop { if q.push(message::new(i)).is_ok() { break; } else { thread::...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/benchmarks/segqueue.rs
crossbeam-channel/benchmarks/segqueue.rs
use crossbeam::queue::SegQueue; use std::thread; mod message; const MESSAGES: usize = 5_000_000; const THREADS: usize = 4; fn seq() { let q = SegQueue::new(); for i in 0..MESSAGES { q.push(message::new(i)); } for _ in 0..MESSAGES { q.pop().unwrap(); } } fn spsc() { let q = ...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/benchmarks/futures-channel.rs
crossbeam-channel/benchmarks/futures-channel.rs
use futures::channel::mpsc; use futures::executor::{block_on, ThreadPool}; use futures::{future, stream, SinkExt, StreamExt}; mod message; const MESSAGES: usize = 5_000_000; const THREADS: usize = 4; fn seq_unbounded() { block_on(async { let (tx, rx) = mpsc::unbounded(); for i in 0..MESSAGES { ...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/benchmarks/flume.rs
crossbeam-channel/benchmarks/flume.rs
mod message; const MESSAGES: usize = 5_000_000; const THREADS: usize = 4; pub fn shuffle<T>(v: &mut [T]) { use std::cell::Cell; use std::num::Wrapping; let len = v.len(); if len <= 1 { return; } thread_local! { static RNG: Cell<Wrapping<u32>> = const { Cell::new(Wrapping(1)) ...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/benchmarks/crossbeam-channel.rs
crossbeam-channel/benchmarks/crossbeam-channel.rs
use crossbeam_channel::{bounded, unbounded, Receiver, Select, Sender}; mod message; const MESSAGES: usize = 5_000_000; const THREADS: usize = 4; fn new<T>(cap: Option<usize>) -> (Sender<T>, Receiver<T>) { match cap { None => unbounded(), Some(cap) => bounded(cap), } } fn seq(cap: Option<usiz...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/benchmarks/crossbeam-deque.rs
crossbeam-channel/benchmarks/crossbeam-deque.rs
use crossbeam_deque::{Steal, Worker}; use std::thread; mod message; const MESSAGES: usize = 5_000_000; fn seq() { let tx = Worker::new_lifo(); let rx = tx.stealer(); for i in 0..MESSAGES { tx.push(message::new(i)); } for _ in 0..MESSAGES { match rx.steal() { Steal::S...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/benchmarks/bus.rs
crossbeam-channel/benchmarks/bus.rs
use bus::Bus; mod message; const MESSAGES: usize = 5_000_000; fn seq(cap: usize) { let mut tx = Bus::new(cap); let mut rx = tx.add_rx(); for i in 0..MESSAGES { tx.broadcast(message::new(i)); } for _ in 0..MESSAGES { rx.recv().unwrap(); } } fn spsc(cap: usize) { let mut ...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/benchmarks/message.rs
crossbeam-channel/benchmarks/message.rs
use std::fmt; const LEN: usize = 1; #[derive(Clone, Copy)] pub(crate) struct Message(#[allow(dead_code)] [usize; LEN]); impl fmt::Debug for Message { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.pad("Message") } } #[inline] pub(crate) fn new(num: usize) -> Message { Message([num;...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/benchmarks/atomicringqueue.rs
crossbeam-channel/benchmarks/atomicringqueue.rs
use atomicring::AtomicRingQueue; use std::thread; mod message; const MESSAGES: usize = 5_000_000; const THREADS: usize = 4; fn seq(cap: usize) { let q = AtomicRingQueue::with_capacity(cap); for i in 0..MESSAGES { loop { if q.try_push(message::new(i)).is_ok() { break; ...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/benchmarks/atomicring.rs
crossbeam-channel/benchmarks/atomicring.rs
use atomicring::AtomicRingBuffer; use std::thread; mod message; const MESSAGES: usize = 5_000_000; const THREADS: usize = 4; fn seq(cap: usize) { let q = AtomicRingBuffer::with_capacity(cap); for i in 0..MESSAGES { loop { if q.try_push(message::new(i)).is_ok() { break; ...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/src/select.rs
crossbeam-channel/src/select.rs
//! Interface to the select mechanism. use std::fmt; use std::marker::PhantomData; use std::mem; use std::time::{Duration, Instant}; use std::vec::Vec; use crossbeam_utils::Backoff; use crate::channel::{self, Receiver, Sender}; use crate::context::Context; use crate::err::{ReadyTimeoutError, TryReadyError}; use crat...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
true
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/src/lib.rs
crossbeam-channel/src/lib.rs
//! Multi-producer multi-consumer channels for message passing. //! //! This crate is an alternative to [`std::sync::mpsc`] with more features and better performance. //! //! # Hello, world! //! //! ``` //! use crossbeam_channel::unbounded; //! //! // Create a channel of unbounded capacity. //! let (s, r) = unbounded()...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/src/select_macro.rs
crossbeam-channel/src/select_macro.rs
//! The `select!` macro. /// A helper macro for `select!` to hide the long list of macro patterns from the documentation. /// /// The macro consists of two stages: /// 1. Parsing /// 2. Code generation /// /// The parsing stage consists of these subparts: /// 1. `@list`: Turns a list of tokens into a list of cases. //...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
true
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/src/utils.rs
crossbeam-channel/src/utils.rs
//! Miscellaneous utilities. use std::cell::Cell; use std::num::Wrapping; use std::thread; use std::time::{Duration, Instant}; /// Randomly shuffles a slice. pub(crate) fn shuffle<T>(v: &mut [T]) { let len = v.len(); if len <= 1 { return; } std::thread_local! { static RNG: Cell<Wrappi...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/src/err.rs
crossbeam-channel/src/err.rs
use std::error; use std::fmt; /// An error returned from the [`send`] method. /// /// The message could not be sent because the channel is disconnected. /// /// The error contains the message so it can be recovered. /// /// [`send`]: super::Sender::send #[derive(PartialEq, Eq, Clone, Copy)] pub struct SendError<T>(pub...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/src/waker.rs
crossbeam-channel/src/waker.rs
//! Waking mechanism for threads blocked on channel operations. use std::ptr; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Mutex; use std::thread::{self, ThreadId}; use std::vec::Vec; use crate::context::Context; use crate::select::{Operation, Selected}; /// Represents a thread blocked on a specific...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/src/counter.rs
crossbeam-channel/src/counter.rs
//! Reference counter for channels. use std::boxed::Box; use std::ops; use std::process; use std::ptr::NonNull; use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; /// Reference counter internals. struct Counter<C> { /// The number of senders associated with the channel. senders: AtomicUsize, ///...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/src/channel.rs
crossbeam-channel/src/channel.rs
//! The channel interface. use std::fmt; use std::iter::FusedIterator; use std::mem; use std::panic::{RefUnwindSafe, UnwindSafe}; use std::sync::Arc; use std::time::{Duration, Instant}; use crate::context::Context; use crate::counter; use crate::err::{ RecvError, RecvTimeoutError, SendError, SendTimeoutError, Try...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
true
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/src/context.rs
crossbeam-channel/src/context.rs
//! Thread-local context used in select. use std::cell::Cell; use std::ptr; use std::sync::atomic::{AtomicPtr, AtomicUsize, Ordering}; use std::sync::Arc; use std::thread::{self, Thread, ThreadId}; use std::time::Instant; use crossbeam_utils::Backoff; use crate::select::Selected; /// Thread-local context used in se...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/src/flavors/array.rs
crossbeam-channel/src/flavors/array.rs
//! Bounded channel based on a preallocated array. //! //! This flavor has a fixed, positive capacity. //! //! The implementation is based on Dmitry Vyukov's bounded MPMC queue. //! //! Source: //! - <http://www.1024cores.net/home/lock-free-algorithms/queues/bounded-mpmc-queue> //! - <https://docs.google.com/docume...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/src/flavors/never.rs
crossbeam-channel/src/flavors/never.rs
//! Channel that never delivers messages. //! //! Messages cannot be sent into this kind of channel. use std::marker::PhantomData; use std::time::Instant; use crate::context::Context; use crate::err::{RecvTimeoutError, TryRecvError}; use crate::select::{Operation, SelectHandle, Token}; use crate::utils; /// This fla...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/src/flavors/list.rs
crossbeam-channel/src/flavors/list.rs
//! Unbounded channel implemented as a linked list. use std::alloc::{alloc_zeroed, handle_alloc_error, Layout}; use std::boxed::Box; use std::cell::UnsafeCell; use std::marker::PhantomData; use std::mem::MaybeUninit; use std::ptr; use std::sync::atomic::{self, AtomicPtr, AtomicUsize, Ordering}; use std::time::Instant;...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/src/flavors/mod.rs
crossbeam-channel/src/flavors/mod.rs
//! Channel flavors. //! //! There are six flavors: //! //! 1. `at` - Channel that delivers a message after a certain amount of time. //! 2. `array` - Bounded channel based on a preallocated array. //! 3. `list` - Unbounded channel implemented as a linked list. //! 4. `never` - Channel that never delivers messages. //!...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/src/flavors/zero.rs
crossbeam-channel/src/flavors/zero.rs
//! Zero-capacity channel. //! //! This kind of channel is also known as *rendezvous* channel. use std::boxed::Box; use std::cell::UnsafeCell; use std::marker::PhantomData; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Mutex; use std::time::Instant; use std::{fmt, ptr}; use crossbeam_utils::Backoff; ...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/src/flavors/at.rs
crossbeam-channel/src/flavors/at.rs
//! Channel that delivers a message at a certain moment in time. //! //! Messages cannot be sent into this kind of channel; they are materialized on demand. use std::sync::atomic::{AtomicBool, Ordering}; use std::thread; use std::time::Instant; use crate::context::Context; use crate::err::{RecvTimeoutError, TryRecvEr...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/src/flavors/tick.rs
crossbeam-channel/src/flavors/tick.rs
//! Channel that delivers messages periodically. //! //! Messages cannot be sent into this kind of channel; they are materialized on demand. use std::thread; use std::time::{Duration, Instant}; use crossbeam_utils::atomic::AtomicCell; use crate::context::Context; use crate::err::{RecvTimeoutError, TryRecvError}; use...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/tests/same_channel.rs
crossbeam-channel/tests/same_channel.rs
#![allow(clippy::redundant_clone)] use std::time::Duration; use crossbeam_channel::{after, bounded, never, tick, unbounded}; fn ms(ms: u64) -> Duration { Duration::from_millis(ms) } #[test] fn after_same_channel() { let r = after(ms(50)); let r2 = r.clone(); assert!(r.same_channel(&r2)); let r...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/tests/golang.rs
crossbeam-channel/tests/golang.rs
//! Tests copied from Go and manually rewritten in Rust. //! //! Source: //! - https://github.com/golang/go //! //! Copyright & License: //! - Copyright (c) 2009 The Go Authors //! - https://golang.org/AUTHORS //! - https://golang.org/LICENSE //! - https://golang.org/PATENTS #![allow(clippy::redundant_clone)...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
true
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/tests/array.rs
crossbeam-channel/tests/array.rs
//! Tests for the array channel flavor. use std::any::Any; use std::sync::atomic::AtomicUsize; use std::sync::atomic::Ordering; use std::thread; use std::time::Duration; use crossbeam_channel::{bounded, select, Receiver}; use crossbeam_channel::{RecvError, RecvTimeoutError, TryRecvError}; use crossbeam_channel::{Send...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/tests/mpsc.rs
crossbeam-channel/tests/mpsc.rs
//! Tests copied from `std::sync::mpsc`. //! //! This is a copy of tests for the `std::sync::mpsc` channels from the standard library, but //! modified to work with `crossbeam-channel` instead. //! //! Minor tweaks were needed to make the tests compile: //! //! - Replace `box` syntax with `Box::new`. //! - Replace all ...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
true
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/tests/select.rs
crossbeam-channel/tests/select.rs
//! Tests for channel selection using the `Select` struct. use std::any::Any; use std::cell::Cell; use std::thread; use std::time::{Duration, Instant}; use crossbeam_channel::{after, bounded, tick, unbounded, Receiver, Select, TryRecvError}; use crossbeam_utils::thread::scope; fn ms(ms: u64) -> Duration { Durati...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
true
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/tests/never.rs
crossbeam-channel/tests/never.rs
//! Tests for the never channel flavor. use std::thread; use std::time::{Duration, Instant}; use crossbeam_channel::{never, select, tick, unbounded}; fn ms(ms: u64) -> Duration { Duration::from_millis(ms) } #[test] fn smoke() { select! { recv(never::<i32>()) -> _ => panic!(), default => {} ...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/tests/list.rs
crossbeam-channel/tests/list.rs
//! Tests for the list channel flavor. use std::any::Any; use std::sync::atomic::AtomicUsize; use std::sync::atomic::Ordering; use std::thread; use std::time::Duration; use crossbeam_channel::{select, unbounded, Receiver}; use crossbeam_channel::{RecvError, RecvTimeoutError, TryRecvError}; use crossbeam_channel::{Sen...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/tests/ready.rs
crossbeam-channel/tests/ready.rs
//! Tests for channel readiness using the `Select` struct. use std::any::Any; use std::cell::Cell; use std::thread; use std::time::{Duration, Instant}; use crossbeam_channel::{after, bounded, tick, unbounded}; use crossbeam_channel::{Receiver, Select, TryRecvError, TrySendError}; use crossbeam_utils::thread::scope; ...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/tests/select_macro.rs
crossbeam-channel/tests/select_macro.rs
//! Tests for the `select!` macro. #![forbid(unsafe_code)] // select! is safe. #![allow(clippy::match_single_binding)] use std::any::Any; use std::cell::Cell; use std::ops::Deref; use std::thread; use std::time::{Duration, Instant}; use crossbeam_channel::{after, bounded, never, select, select_biased, tick, unbounde...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
true
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/tests/zero.rs
crossbeam-channel/tests/zero.rs
//! Tests for the zero channel flavor. use std::any::Any; use std::sync::atomic::AtomicUsize; use std::sync::atomic::Ordering; use std::thread; use std::time::Duration; use crossbeam_channel::{bounded, select, Receiver}; use crossbeam_channel::{RecvError, RecvTimeoutError, TryRecvError}; use crossbeam_channel::{SendE...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/tests/tick.rs
crossbeam-channel/tests/tick.rs
//! Tests for the tick channel flavor. #![cfg(not(miri))] // TODO: many assertions failed due to Miri is slow use std::sync::atomic::AtomicUsize; use std::sync::atomic::Ordering; use std::thread; use std::time::{Duration, Instant}; use crossbeam_channel::{after, select, tick, Select, TryRecvError}; use crossbeam_uti...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/tests/iter.rs
crossbeam-channel/tests/iter.rs
//! Tests for iteration over receivers. use crossbeam_channel::unbounded; use crossbeam_utils::thread::scope; #[test] fn nested_recv_iter() { let (s, r) = unbounded::<i32>(); let (total_s, total_r) = unbounded::<i32>(); scope(|scope| { scope.spawn(move |_| { let mut acc = 0; ...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/tests/thread_locals.rs
crossbeam-channel/tests/thread_locals.rs
//! Tests that make sure accessing thread-locals while exiting the thread doesn't cause panics. #![cfg(not(miri))] // Miri detects that this test is buggy: the destructor of `FOO` uses `std::thread::current()`! use std::thread; use std::time::Duration; use crossbeam_channel::{select, unbounded}; use crossbeam_utils:...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/tests/after.rs
crossbeam-channel/tests/after.rs
//! Tests for the after channel flavor. #![cfg(not(miri))] // TODO: many assertions failed due to Miri is slow use std::sync::atomic::AtomicUsize; use std::sync::atomic::Ordering; use std::thread; use std::time::{Duration, Instant}; use crossbeam_channel::{after, select, Select, TryRecvError}; use crossbeam_utils::t...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/benches/crossbeam.rs
crossbeam-channel/benches/crossbeam.rs
#![feature(test)] extern crate test; use crossbeam_channel::{bounded, unbounded}; use crossbeam_utils::thread::scope; use test::Bencher; const TOTAL_STEPS: usize = 40_000; mod unbounded { use super::*; #[bench] fn create(b: &mut Bencher) { b.iter(unbounded::<i32>); } #[bench] fn on...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/examples/matching.rs
crossbeam-channel/examples/matching.rs
//! Using `select!` to send and receive on the same channel at the same time. //! //! This example is based on the following program in Go. //! //! Source: //! - https://web.archive.org/web/20171209034309/https://www.nada.kth.se/~snilsson/concurrency //! - http://www.nada.kth.se/~snilsson/concurrency/src/matching.g...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/examples/stopwatch.rs
crossbeam-channel/examples/stopwatch.rs
//! Prints the elapsed time every 1 second and quits on Ctrl+C. #[cfg(windows)] // signal_hook::iterator does not work on windows fn main() { println!("This example does not work on Windows"); } #[cfg(not(windows))] fn main() { use std::io; use std::thread; use std::time::{Duration, Instant}; use...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
crossbeam-rs/crossbeam
https://github.com/crossbeam-rs/crossbeam/blob/983d56b6007ca4c22b56a665a7785f40f55c2a53/crossbeam-channel/examples/fibonacci.rs
crossbeam-channel/examples/fibonacci.rs
//! An asynchronous fibonacci sequence generator. use std::thread; use crossbeam_channel::{bounded, Sender}; // Sends the Fibonacci sequence into the channel until it becomes disconnected. fn fibonacci(sender: Sender<u64>) { let (mut x, mut y) = (0, 1); while sender.send(x).is_ok() { let tmp = x; ...
rust
Apache-2.0
983d56b6007ca4c22b56a665a7785f40f55c2a53
2026-01-04T15:48:03.794677Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/python/build.rs
python/build.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors fn main() { pyo3_build_config::add_extension_module_link_args(); }
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/python/src/lib.rs
python/src/lib.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors use arrow::RecordBatchStream; use connection::{connect, Connection}; use env_logger::Env; use index::IndexConfig; use permutation::{PyAsyncPermutationBuilder, PyPermutationReader}; use pyo3::{ pymodule, types::{PyMo...
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/python/src/index.rs
python/src/index.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors use lancedb::index::vector::{IvfFlatIndexBuilder, IvfRqIndexBuilder, IvfSqIndexBuilder}; use lancedb::index::{ scalar::{BTreeIndexBuilder, FtsIndexBuilder}, vector::{IvfHnswPqIndexBuilder, IvfHnswSqIndexBuilder, Ivf...
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/python/src/session.rs
python/src/session.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors use std::sync::Arc; use lancedb::{ObjectStoreRegistry, Session as LanceSession}; use pyo3::{pyclass, pymethods, PyResult}; /// A session for managing caches and object stores across LanceDB operations. /// /// Sessions al...
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/python/src/arrow.rs
python/src/arrow.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors use std::sync::Arc; use arrow::{ datatypes::SchemaRef, pyarrow::{IntoPyArrow, ToPyArrow}, }; use futures::stream::StreamExt; use lancedb::arrow::SendableRecordBatchStream; use pyo3::{ exceptions::PyStopAsyncIte...
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/python/src/table.rs
python/src/table.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors use std::{collections::HashMap, sync::Arc}; use crate::{ connection::Connection, error::PythonErrorExt, index::{extract_index_params, IndexConfig}, query::{Query, TakeQuery}, }; use arrow::{ datatypes::{...
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/python/src/connection.rs
python/src/connection.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors use std::{collections::HashMap, sync::Arc, time::Duration}; use arrow::{datatypes::Schema, ffi_stream::ArrowArrayStreamReader, pyarrow::FromPyArrow}; use lancedb::{ connection::Connection as LanceConnection, databa...
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/python/src/header.rs
python/src/header.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors use pyo3::prelude::*; use pyo3::types::PyDict; use std::collections::HashMap; /// A wrapper around a Python HeaderProvider that can be called from Rust pub struct PyHeaderProvider { provider: Py<PyAny>, } impl Clone f...
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/python/src/error.rs
python/src/error.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors use pyo3::{ exceptions::{PyIOError, PyNotImplementedError, PyOSError, PyRuntimeError, PyValueError}, intern, types::{PyAnyMethods, PyNone}, PyErr, PyResult, Python, }; use lancedb::error::Error as LanceErro...
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/python/src/util.rs
python/src/util.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors use std::sync::Mutex; use lancedb::DistanceType; use pyo3::{ exceptions::{PyRuntimeError, PyValueError}, pyfunction, PyResult, }; /// A wrapper around a rust builder /// /// Rust builders are often implemented so ...
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/python/src/query.rs
python/src/query.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors use std::sync::Arc; use std::time::Duration; use arrow::array::make_array; use arrow::array::Array; use arrow::array::ArrayData; use arrow::pyarrow::FromPyArrow; use arrow::pyarrow::IntoPyArrow; use arrow::pyarrow::ToPyArr...
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
true
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/python/src/permutation.rs
python/src/permutation.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors use std::sync::{Arc, Mutex}; use crate::{ arrow::RecordBatchStream, connection::Connection, error::PythonErrorExt, table::Table, }; use arrow::pyarrow::ToPyArrow; use lancedb::{ dataloader::permutation::{ b...
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/python/src/storage_options.rs
python/src/storage_options.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors //! PyO3 bindings for StorageOptionsProvider //! //! This module provides the bridge between Python StorageOptionsProvider objects //! and Rust's StorageOptionsProvider trait, enabling automatic credential refresh. use std...
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/nodejs/build.rs
nodejs/build.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors extern crate napi_build; fn main() { napi_build::setup(); }
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/nodejs/src/merge.rs
nodejs/src/merge.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors use std::time::Duration; use lancedb::{arrow::IntoArrow, ipc::ipc_file_to_batches, table::merge::MergeInsertBuilder}; use napi::bindgen_prelude::*; use napi_derive::napi; use crate::{error::convert_error, table::MergeResu...
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/nodejs/src/lib.rs
nodejs/src/lib.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors use std::collections::HashMap; use env_logger::Env; use napi_derive::*; mod connection; mod error; mod header; mod index; mod iterator; pub mod merge; pub mod permutation; mod query; pub mod remote; mod rerankers; mod ses...
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/nodejs/src/index.rs
nodejs/src/index.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors use std::sync::Mutex; use lancedb::index::scalar::{BTreeIndexBuilder, FtsIndexBuilder}; use lancedb::index::vector::{ IvfFlatIndexBuilder, IvfHnswPqIndexBuilder, IvfHnswSqIndexBuilder, IvfPqIndexBuilder, IvfRqIndex...
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/nodejs/src/session.rs
nodejs/src/session.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors use std::sync::Arc; use lancedb::{ObjectStoreRegistry, Session as LanceSession}; use napi::bindgen_prelude::*; use napi_derive::*; /// A session for managing caches and object stores across LanceDB operations. /// /// Ses...
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/nodejs/src/remote.rs
nodejs/src/remote.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors use std::collections::HashMap; use napi_derive::*; /// Timeout configuration for remote HTTP client. #[napi(object)] #[derive(Debug)] pub struct TimeoutConfig { /// The overall timeout for the entire request in second...
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/nodejs/src/table.rs
nodejs/src/table.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors use std::collections::HashMap; use lancedb::ipc::ipc_file_to_batches; use lancedb::table::{ AddDataMode, ColumnAlteration as LanceColumnAlteration, Duration, NewColumnTransform, OptimizeAction, OptimizeOptions, Tab...
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/nodejs/src/connection.rs
nodejs/src/connection.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors use std::collections::HashMap; use std::sync::Arc; use lancedb::database::{CreateTableMode, Database}; use napi::bindgen_prelude::*; use napi_derive::*; use crate::error::NapiErrorExt; use crate::header::JsHeaderProvider;...
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/nodejs/src/rerankers.rs
nodejs/src/rerankers.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors use arrow_array::RecordBatch; use async_trait::async_trait; use napi::{ bindgen_prelude::*, threadsafe_function::{ErrorStrategy, ThreadsafeFunction}, }; use napi_derive::napi; use lancedb::ipc::batches_to_ipc_file;...
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/nodejs/src/header.rs
nodejs/src/header.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors use napi::{ bindgen_prelude::*, threadsafe_function::{ErrorStrategy, ThreadsafeFunction}, }; use napi_derive::napi; use std::collections::HashMap; use std::sync::Arc; /// JavaScript HeaderProvider implementation th...
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/nodejs/src/error.rs
nodejs/src/error.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors pub type Result<T> = napi::Result<T>; pub trait NapiErrorExt<T> { /// Convert to a napi error using from_reason(err.to_string()) fn default_error(self) -> Result<T>; } impl<T> NapiErrorExt<T> for std::result::Resu...
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/nodejs/src/util.rs
nodejs/src/util.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors use arrow_ipc::writer::FileWriter; use arrow_schema::Schema; use lancedb::DistanceType; use napi::bindgen_prelude::Buffer; pub fn parse_distance_type(distance_type: impl AsRef<str>) -> napi::Result<DistanceType> { matc...
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/nodejs/src/iterator.rs
nodejs/src/iterator.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors use futures::StreamExt; use lancedb::arrow::SendableRecordBatchStream; use lancedb::ipc::batches_to_ipc_file; use napi::bindgen_prelude::*; use napi_derive::napi; /** Typescript-style Async Iterator over RecordBatches */ #...
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/nodejs/src/query.rs
nodejs/src/query.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors use std::sync::Arc; use lancedb::index::scalar::{ BooleanQuery, BoostQuery, FtsQuery, FullTextSearchQuery, MatchQuery, MultiMatchQuery, Occur, Operator, PhraseQuery, }; use lancedb::query::ExecutableQuery; use lanc...
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/nodejs/src/permutation.rs
nodejs/src/permutation.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors use std::sync::{Arc, Mutex}; use crate::{error::NapiErrorExt, table::Table}; use lancedb::dataloader::{ permutation::builder::{PermutationBuilder as LancePermutationBuilder, ShuffleStrategy}, permutation::split::{S...
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/rust/lancedb/src/lib.rs
rust/lancedb/src/lib.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors //! [LanceDB](https://github.com/lancedb/lancedb) is an open-source database for vector-search built with persistent storage, //! which greatly simplifies retrieval, filtering and management of embeddings. //! //! The key f...
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/rust/lancedb/src/index.rs
rust/lancedb/src/index.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors use scalar::FtsIndexBuilder; use serde::Deserialize; use serde_with::skip_serializing_none; use std::sync::Arc; use std::time::Duration; use vector::IvfFlatIndexBuilder; use crate::index::vector::IvfRqIndexBuilder; use cra...
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false
lancedb/lancedb
https://github.com/lancedb/lancedb/blob/d67a8743ba962dc1ae4456fa68ceebc16e202ee5/rust/lancedb/src/embeddings.rs
rust/lancedb/src/embeddings.rs
// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright The LanceDB Authors #[cfg(feature = "openai")] pub mod openai; #[cfg(feature = "sentence-transformers")] pub mod sentence_transformers; #[cfg(feature = "bedrock")] pub mod bedrock; use lance_arrow::RecordBatchExt; use std::{ borrow::Cow...
rust
Apache-2.0
d67a8743ba962dc1ae4456fa68ceebc16e202ee5
2026-01-04T15:47:39.566845Z
false