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 |
|---|---|---|---|---|---|---|---|---|
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/btuuid.rs | src/btuuid.rs | //! `Uuid` extensions for Bluetooth UUIDs
use crate::Uuid;
/// This is the Bluetooth Base UUID. It is used with 16-bit and 32-bit UUIDs
/// [defined](https://www.bluetooth.com/specifications/assigned-numbers/) by the Bluetooth SIG.
pub const BLUETOOTH_BASE_UUID: u128 = 0x00000000_0000_1000_8000_00805f9b34fb;
/// Con... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | true |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/android.rs | src/android.rs | use java_spaghetti::{CastError, Local};
use self::bindings::java::lang::Throwable;
use crate::error::ErrorKind;
pub mod adapter;
pub mod characteristic;
pub mod descriptor;
pub mod device;
pub mod l2cap_channel;
pub mod service;
#[allow(mismatched_lifetime_syntaxes)]
pub(crate) mod bindings;
/// A platform-specific... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/pairing.rs | src/pairing.rs | //! Custom Bluetooth pairing agent.
use async_trait::async_trait;
use crate::Device;
/// Bluetooth input/output capabilities for pairing
///
/// See the Bluetooth Core Specification, Vol 3, Part H, §2.3.2
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[non_exhaustive]
pub enum IoCapability {
... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/l2cap_channel.rs | src/l2cap_channel.rs | use std::pin;
use std::task::{Context, Poll};
use futures_lite::io::{AsyncRead, AsyncWrite};
use crate::sys;
#[allow(unused)]
pub(crate) const PIPE_CAPACITY: usize = 0x100000; // 1Mb
macro_rules! derive_async_read {
($type:ty, $field:tt) => {
impl AsyncRead for $type {
fn poll_read(
... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/adapter.rs | src/adapter.rs | #![allow(clippy::let_unit_value)]
use futures_core::Stream;
use crate::{sys, AdapterEvent, AdvertisingDevice, ConnectionEvent, Device, DeviceId, Result, Uuid};
/// The system's Bluetooth adapter interface.
///
/// The default adapter for the system may be accessed with the [`Adapter::default()`] method.
#[derive(Deb... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/error.rs | src/error.rs | //! Bluest errors
/// The error type for Bluetooth operations
#[derive(Debug)]
pub struct Error {
kind: ErrorKind,
source: Option<Box<dyn std::error::Error + Send + Sync + 'static>>,
message: String,
}
impl Error {
pub(crate) fn new<S: ToString>(
kind: ErrorKind,
source: Option<Box<dyn... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/service.rs | src/service.rs | use crate::{sys, Characteristic, Result, Uuid};
/// A Bluetooth GATT service
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Service(pub(crate) sys::service::ServiceImpl);
impl Service {
/// The [`Uuid`] identifying the type of this GATT service
///
/// # Panics
///
/// On Linux, this meth... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/util.rs | src/util.rs | #![allow(unused)] // used depending on the target.
use std::mem::ManuallyDrop;
pub struct ScopeGuard<F: FnOnce()> {
dropfn: ManuallyDrop<F>,
}
impl<F: FnOnce()> ScopeGuard<F> {
pub fn defuse(mut self) {
unsafe { ManuallyDrop::drop(&mut self.dropfn) }
std::mem::forget(self)
}
}
impl<F: Fn... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/windows.rs | src/windows.rs | pub mod adapter;
pub mod characteristic;
pub mod descriptor;
pub mod device;
pub mod error;
pub mod service;
mod types;
mod winver;
/// A platform-specific device identifier.
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub s... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/corebluetooth/descriptor.rs | src/corebluetooth/descriptor.rs | use objc2::msg_send;
use objc2::rc::Retained;
use objc2::runtime::AnyObject;
use objc2_core_bluetooth::{CBDescriptor, CBPeripheralState};
use objc2_foundation::{NSData, NSNumber, NSString, NSUInteger};
use super::delegates::{PeripheralDelegate, PeripheralEvent};
use super::dispatch::Dispatched;
use crate::error::Error... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/corebluetooth/device.rs | src/corebluetooth/device.rs | #![allow(clippy::let_unit_value)]
use futures_core::Stream;
use futures_lite::StreamExt;
use objc2::rc::Retained;
use objc2::runtime::ProtocolObject;
use objc2_core_bluetooth::{CBPeripheral, CBPeripheralState, CBService, CBUUID};
use objc2_foundation::{NSArray, NSData};
use super::delegates::{PeripheralDelegate, Peri... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/corebluetooth/characteristic.rs | src/corebluetooth/characteristic.rs | use futures_core::Stream;
use futures_lite::StreamExt;
use objc2::rc::Retained;
use objc2_core_bluetooth::{
CBCharacteristic, CBCharacteristicProperties, CBCharacteristicWriteType, CBPeripheralState,
};
use objc2_foundation::NSData;
use super::delegates::{PeripheralDelegate, PeripheralEvent};
use super::dispatch::... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/corebluetooth/dispatch.rs | src/corebluetooth/dispatch.rs | use std::cell::UnsafeCell;
use std::hash::{Hash, Hasher};
use std::mem::MaybeUninit;
use std::sync::OnceLock;
use dispatch2::{DispatchQoS, DispatchQueue, DispatchQueueAttr, DispatchRetained};
use objc2::rc::Retained;
use objc2::Message;
/// Get a serial dispatch queue to use for all CoreBluetooth operations
pub(crate... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/corebluetooth/l2cap_channel.rs | src/corebluetooth/l2cap_channel.rs | use core::ptr::NonNull;
use std::io::{Read, Write};
use std::sync::{Arc, Mutex};
use std::task::{Context, Poll};
use std::{fmt, pin};
use futures_lite::io::{AsyncRead, AsyncWrite, BlockOn};
use objc2::rc::Retained;
use objc2::runtime::ProtocolObject;
use objc2::{define_class, msg_send, sel, AnyThread, DefinedClass};
u... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/corebluetooth/adapter.rs | src/corebluetooth/adapter.rs | #![allow(clippy::let_unit_value)]
use std::ops::Deref;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use futures_core::Stream;
use futures_lite::{stream, StreamExt};
use objc2::rc::Retained;
use objc2::runtime::ProtocolObject;
use objc2::{AnyThread, Message};
use objc2_core_bluetooth::{
CBCen... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/corebluetooth/error.rs | src/corebluetooth/error.rs | use objc2::rc::Retained;
use objc2_core_bluetooth::CBError;
use objc2_foundation::NSError;
use crate::error::{AttError, ErrorKind};
impl crate::Error {
pub(super) fn from_recv_error(err: async_broadcast::RecvError) -> Self {
crate::Error::new(ErrorKind::Internal, Some(Box::new(err)), "receiving delegate e... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/corebluetooth/service.rs | src/corebluetooth/service.rs | use objc2::rc::Retained;
use objc2_core_bluetooth::{CBPeripheralState, CBService, CBUUID};
use objc2_foundation::{NSArray, NSData};
use super::delegates::{PeripheralDelegate, PeripheralEvent};
use super::dispatch::Dispatched;
use crate::error::ErrorKind;
use crate::{BluetoothUuidExt, Characteristic, Error, Result, Ser... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/corebluetooth/delegates.rs | src/corebluetooth/delegates.rs | use objc2::rc::Retained;
use objc2::{define_class, msg_send, AnyThread, DefinedClass, Message};
use objc2_core_bluetooth::{
CBCentralManager, CBCentralManagerDelegate, CBCharacteristic, CBConnectionEvent, CBDescriptor, CBL2CAPChannel,
CBPeripheral, CBPeripheralDelegate, CBService,
};
use objc2_foundation::{NSAr... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/corebluetooth/ad.rs | src/corebluetooth/ad.rs | use std::collections::HashMap;
use objc2_core_bluetooth::{
CBAdvertisementDataIsConnectable, CBAdvertisementDataLocalNameKey, CBAdvertisementDataManufacturerDataKey,
CBAdvertisementDataOverflowServiceUUIDsKey, CBAdvertisementDataServiceDataKey, CBAdvertisementDataServiceUUIDsKey,
CBAdvertisementDataTxPower... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/windows/descriptor.rs | src/windows/descriptor.rs | use windows::Devices::Bluetooth::BluetoothCacheMode;
use windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor;
use windows::Storage::Streams::{DataReader, DataWriter};
use super::error::check_communication_status;
use crate::{Descriptor, Result, Uuid};
/// A Bluetooth GATT descriptor
#[derive(Clone, P... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/windows/device.rs | src/windows/device.rs | use std::pin::pin;
use futures_channel::mpsc;
use futures_core::Stream;
use futures_lite::{future, StreamExt};
use tracing::error;
use windows::core::{GUID, HSTRING};
use windows::Devices::Bluetooth::{
BluetoothAddressType, BluetoothCacheMode, BluetoothConnectionStatus, BluetoothLEDevice,
};
use windows::Devices::... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/windows/characteristic.rs | src/windows/characteristic.rs | use futures_core::Stream;
use futures_lite::StreamExt;
use tracing::{error, warn};
use windows::Devices::Bluetooth::BluetoothCacheMode;
use windows::Devices::Bluetooth::GenericAttributeProfile::{
GattCharacteristic, GattClientCharacteristicConfigurationDescriptorValue, GattValueChangedEventArgs,
GattWriteOption... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/windows/winver.rs | src/windows/winver.rs | use std::mem;
use windows::Win32::System::LibraryLoader::{GetModuleHandleW, GetProcAddress};
use windows::Win32::System::SystemInformation::OSVERSIONINFOW;
use windows::{s, w};
fn get_windows_version() -> Option<(u32, u32, u32)> {
let handle = unsafe { GetModuleHandleW(w!("ntdll.dll")).ok()? };
let proc = uns... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/windows/adapter.rs | src/windows/adapter.rs | use std::collections::{HashMap, HashSet};
use std::ffi::OsString;
use std::sync::Arc;
use futures_core::Stream;
use futures_lite::{stream, StreamExt};
use tracing::{debug, error, trace, warn};
use windows::core::HSTRING;
use windows::Devices::Bluetooth::Advertisement::{
BluetoothLEAdvertisement, BluetoothLEAdverti... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/windows/error.rs | src/windows/error.rs | use windows::Devices::Bluetooth::GenericAttributeProfile::GattCommunicationStatus;
use windows::Devices::Enumeration::{DevicePairingResultStatus, DeviceUnpairingResultStatus};
use windows::Foundation::IReference;
use crate::error::ErrorKind;
use crate::Result;
impl From<windows::core::Error> for crate::Error {
fn... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/windows/service.rs | src/windows/service.rs | use windows::core::GUID;
use windows::Devices::Bluetooth::BluetoothCacheMode;
use windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService;
use super::error::check_communication_status;
use crate::error::ErrorKind;
use crate::{Characteristic, Result, Service, Uuid};
/// A Bluetooth GATT service
#[deriv... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/windows/types.rs | src/windows/types.rs | use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
use windows::core::HSTRING;
use windows::Foundation::Collections::{IIterable, IIterable_Impl, IIterator, IIterator_Impl};
#[windows::core::implement(IIterable<HSTRING>)]
pub(super) struct StringVec(Arc<Vec<HSTRING>>);
#[windows::core::implement(IIte... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/android/descriptor.rs | src/android/descriptor.rs | use crate::{Result, Uuid};
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct DescriptorImpl {}
impl DescriptorImpl {
pub fn uuid(&self) -> Uuid {
todo!()
}
pub async fn uuid_async(&self) -> Result<Uuid> {
todo!()
}
pub async fn value(&self) -> Result<Vec<u8>> {
todo!()
... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/android/bindings.rs | src/android/bindings.rs | // WARNING: This file was autogenerated by java-spaghetti. Any changes to this file may be lost!!!
#![allow(unused_imports)]
#![allow(non_camel_case_types)] // We map Java inner classes to Outer_Inner
#![allow(dead_code)] // We generate structs for private Java types too, just in case.
#![allow(deprecated)] // We're... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | true |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/android/device.rs | src/android/device.rs | use futures_core::Stream;
use futures_lite::stream;
use java_spaghetti::Global;
use uuid::Uuid;
use super::bindings::android::bluetooth::BluetoothDevice;
use crate::pairing::PairingAgent;
use crate::{DeviceId, Result, Service, ServicesChanged};
#[derive(Clone)]
pub struct DeviceImpl {
pub(super) id: DeviceId,
... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/android/characteristic.rs | src/android/characteristic.rs | use futures_core::Stream;
use futures_lite::stream;
use uuid::Uuid;
use crate::{CharacteristicProperties, Descriptor, Result};
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct CharacteristicImpl {}
impl CharacteristicImpl {
pub fn uuid(&self) -> Uuid {
todo!()
}
pub async fn uuid_async(&s... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/android/l2cap_channel.rs | src/android/l2cap_channel.rs | #![cfg(feature = "l2cap")]
use std::io::{Read, Write};
use std::sync::Arc;
use std::task::{Context, Poll};
use std::{fmt, pin, slice, thread};
use futures_lite::io::{AsyncRead, AsyncWrite, BlockOn};
use java_spaghetti::{ByteArray, Global, Local, PrimitiveArray};
use tracing::{debug, trace, warn};
use super::bindings... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/android/adapter.rs | src/android/adapter.rs | use std::collections::HashMap;
use std::pin::Pin;
use std::sync::atomic::{AtomicI32, Ordering};
use std::sync::{Arc, Mutex};
use std::task::{Context, Poll};
use async_channel::{Receiver, Sender};
use futures_core::Stream;
use futures_lite::{stream, StreamExt};
use java_spaghetti::{Arg, ByteArray, Env, Global, Local, N... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/android/service.rs | src/android/service.rs | use crate::{Characteristic, Result, Service, Uuid};
#[derive(Debug, Clone)]
pub struct ServiceImpl {}
impl PartialEq for ServiceImpl {
fn eq(&self, _other: &Self) -> bool {
todo!()
}
}
impl Eq for ServiceImpl {}
impl std::hash::Hash for ServiceImpl {
fn hash<H: std::hash::Hasher>(&self, _state: ... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/bluer/descriptor.rs | src/bluer/descriptor.rs | use crate::{Descriptor, Result, Uuid};
/// A Bluetooth GATT descriptor
#[derive(Debug, Clone)]
pub struct DescriptorImpl {
inner: bluer::gatt::remote::Descriptor,
}
impl PartialEq for DescriptorImpl {
fn eq(&self, other: &Self) -> bool {
self.inner.adapter_name() == other.inner.adapter_name()
... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/bluer/device.rs | src/bluer/device.rs | use std::sync::Arc;
use futures_core::Stream;
use futures_lite::StreamExt;
use super::DeviceId;
use crate::device::ServicesChanged;
use crate::error::ErrorKind;
use crate::pairing::PairingAgent;
use crate::{btuuid, AdvertisementData, Device, Error, ManufacturerData, Result, Service, Uuid};
/// A Bluetooth LE device
... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/bluer/characteristic.rs | src/bluer/characteristic.rs | use bluer::gatt::remote::CharacteristicWriteRequest;
use bluer::gatt::WriteOp;
use futures_core::Stream;
use futures_lite::StreamExt;
use crate::{Characteristic, CharacteristicProperties, Descriptor, Result, Uuid};
/// A Bluetooth GATT characteristic
#[derive(Debug, Clone)]
pub struct CharacteristicImpl {
inner: ... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/bluer/l2cap_channel.rs | src/bluer/l2cap_channel.rs | #![cfg(feature = "l2cap")]
use std::fmt::Debug;
use std::pin;
use std::task::{Context, Poll};
use async_compat::Compat;
use bluer::l2cap::stream::{OwnedReadHalf, OwnedWriteHalf};
use bluer::l2cap::Stream;
use futures_lite::io::{AsyncRead, AsyncWrite};
use crate::l2cap_channel::{derive_async_read, derive_async_write}... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/bluer/adapter.rs | src/bluer/adapter.rs | use std::sync::Arc;
use bluer::AdapterProperty;
use futures_core::Stream;
use futures_lite::StreamExt;
use crate::error::ErrorKind;
use crate::{AdapterEvent, AdvertisingDevice, ConnectionEvent, Device, DeviceId, Error, Result, Uuid};
#[derive(Default)]
pub struct AdapterConfig {
/// Name of adapter to use.
p... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/bluer/error.rs | src/bluer/error.rs | use crate::error::ErrorKind;
impl From<bluer::Error> for crate::Error {
fn from(err: bluer::Error) -> Self {
crate::Error::new(kind_from_bluer(&err), Some(Box::new(err)), String::new())
}
}
fn kind_from_bluer(err: &bluer::Error) -> ErrorKind {
match err.kind {
bluer::ErrorKind::ConnectionA... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/src/bluer/service.rs | src/bluer/service.rs | use std::sync::Arc;
use crate::{Characteristic, Result, Service, Uuid};
/// A Bluetooth GATT service
#[derive(Debug, Clone)]
pub struct ServiceImpl {
pub(super) inner: bluer::gatt::remote::Service,
device: Arc<bluer::Device>,
}
impl PartialEq for ServiceImpl {
fn eq(&self, other: &Self) -> bool {
... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/tests/check_api.rs | tests/check_api.rs | #![allow(clippy::let_unit_value)]
use bluest::*;
use futures_lite::StreamExt;
fn assert_send<T: Send>(t: T) -> T {
t
}
async fn check_adapter_apis(adapter: Adapter) -> Result<Device> {
let events: Result<_> = assert_send(adapter.events()).await;
let _event: Option<Result<AdapterEvent>> = assert_send(even... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/examples/reconnect.rs | examples/reconnect.rs | use std::error::Error;
use std::time::Duration;
use bluest::{btuuid, Adapter};
use futures_lite::StreamExt;
use tracing::info;
use tracing::metadata::LevelFilter;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
use tracing_subscriber::prelude::*;
use tracing_subscriber::{fmt, EnvFilter};
t... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/examples/connected.rs | examples/connected.rs | use std::error::Error;
use bluest::Adapter;
use tracing::info;
use tracing::metadata::LevelFilter;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
use tracing_subscriber::prelude::*;
use tracing_subscriber::{fmt, EnvFilter};
tracing_subscriber::registry()
.with(fmt::layer())
... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/examples/pair.rs | examples/pair.rs | use std::error::Error;
use async_trait::async_trait;
use bluest::pairing::{IoCapability, PairingAgent, PairingRejected, Passkey};
use bluest::{btuuid, Adapter, Device};
use futures_lite::StreamExt;
use tracing::info;
use tracing::metadata::LevelFilter;
struct StdioPairingAgent;
#[async_trait]
impl PairingAgent for S... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/examples/connect.rs | examples/connect.rs | use std::error::Error;
use std::time::Duration;
use bluest::{btuuid, Adapter};
use futures_lite::StreamExt;
use tracing::info;
use tracing::metadata::LevelFilter;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
use tracing_subscriber::prelude::*;
use tracing_subscriber::{fmt, EnvFilter};
t... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/examples/scan.rs | examples/scan.rs | use std::error::Error;
use bluest::Adapter;
use futures_lite::StreamExt;
use tracing::info;
use tracing::metadata::LevelFilter;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
use tracing_subscriber::prelude::*;
use tracing_subscriber::{fmt, EnvFilter};
tracing_subscriber::registry()
... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
alexmoon/bluest | https://github.com/alexmoon/bluest/blob/37e353d778b43d4892d2b7315cb5fba6cd5cb969/examples/blinky.rs | examples/blinky.rs | use std::error::Error;
use std::time::Duration;
use bluest::{Adapter, Uuid};
use futures_lite::{future, StreamExt};
use tracing::metadata::LevelFilter;
use tracing::{error, info};
const NORDIC_LED_AND_BUTTON_SERVICE: Uuid = Uuid::from_u128(0x00001523_1212_efde_1523_785feabcd123);
const BLINKY_BUTTON_STATE_CHARACTERIS... | rust | Apache-2.0 | 37e353d778b43d4892d2b7315cb5fba6cd5cb969 | 2026-01-04T20:23:19.181316Z | false |
mrmekon/fruitbasket | https://github.com/mrmekon/fruitbasket/blob/3fdebfa159a2248dc55def22edd2aedabd1f294c/src/lib.rs | src/lib.rs | //! fruitbasket - Framework for running Rust programs in a Mac 'app bundle' environment.
//!
//! fruitbasket provides two different (but related) services for helping you run your
//! Rust binaries as native AppKit/Cocoa applications on Mac OS X:
//!
//! * App lifecycle and environment API - fruitbasket provides an API... | rust | Apache-2.0 | 3fdebfa159a2248dc55def22edd2aedabd1f294c | 2026-01-04T20:23:17.312436Z | false |
mrmekon/fruitbasket | https://github.com/mrmekon/fruitbasket/blob/3fdebfa159a2248dc55def22edd2aedabd1f294c/src/osx.rs | src/osx.rs | //! fruitbasket - Framework for running Rust programs in a Mac 'app bundle' environment.
//!
//! fruitbasket provides two different (but related) services for helping you run your
//! Rust binaries as native AppKit/Cocoa applications on Mac OS X:
//!
//! * App lifecycle and environment API - fruitbasket provides an API... | rust | Apache-2.0 | 3fdebfa159a2248dc55def22edd2aedabd1f294c | 2026-01-04T20:23:17.312436Z | true |
mrmekon/fruitbasket | https://github.com/mrmekon/fruitbasket/blob/3fdebfa159a2248dc55def22edd2aedabd1f294c/examples/example.rs | examples/example.rs | extern crate fruitbasket;
use fruitbasket::ActivationPolicy;
use fruitbasket::Trampoline;
use fruitbasket::FruitApp;
use fruitbasket::InstallDir;
use fruitbasket::RunPeriod;
use fruitbasket::FruitError;
use std::time::Duration;
use std::path::PathBuf;
#[macro_use]
extern crate log;
fn main() {
let _ = fruitbasket... | rust | Apache-2.0 | 3fdebfa159a2248dc55def22edd2aedabd1f294c | 2026-01-04T20:23:17.312436Z | false |
mrmekon/fruitbasket | https://github.com/mrmekon/fruitbasket/blob/3fdebfa159a2248dc55def22edd2aedabd1f294c/examples/register_url.rs | examples/register_url.rs | /// Example that launches as Mac App with custom URL scheme handler
///
/// In one terminal, build and run:
///
/// $ cargo build --features=logging --examples
/// $ ./target/debug/examples/register_url && tail -f ~/.fruitbasket_register_url.log
///
/// In a second terminal, open custom URL:
///
/// $ open fruitbasket:... | rust | Apache-2.0 | 3fdebfa159a2248dc55def22edd2aedabd1f294c | 2026-01-04T20:23:17.312436Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/src/udc.rs | src/udc.rs | //! USB device controller (UDC).
use std::{
ffi::{OsStr, OsString},
fmt, fs,
io::{Error, ErrorKind, Result},
os::unix::prelude::OsStringExt,
path::{Path, PathBuf},
};
use crate::{trim_os_str, Speed};
/// USB device controller (UDC).
///
/// Call [`udcs`] to obtain the controllers available on the... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/src/lib.rs | src/lib.rs | //! This library allows implementation of USB peripherals, so called **USB gadgets**,
//! on Linux devices that have a USB device controller (UDC).
//! Both, pre-defined USB functions and fully custom implementations of the USB
//! interface are supported.
//!
//! ### Requirements
//!
//! A USB device controller (UDC) ... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/src/gadget.rs | src/gadget.rs | //! USB gadget.
use nix::errno::Errno;
use std::{
collections::{HashMap, HashSet},
ffi::{OsStr, OsString},
fmt, fs,
io::{Error, ErrorKind, Result},
os::unix::{
fs::symlink,
prelude::{OsStrExt, OsStringExt},
},
path::{Path, PathBuf},
};
use crate::{
configfs_dir, functio... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/src/lang.rs | src/lang.rs | /// USB language id.
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[non_exhaustive]
pub enum Language {
/// Afrikaans
Afrikaans,
/// Albanian
Albanian,
/// Arabic (Saudi Arabia)
ArabicSaudiArabia,
/// Arabic (Iraq)
ArabicIraq,
/// Arabic (Egypt)
Ar... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/src/function/video.rs | src/function/video.rs | //! USB Video Class (UVC) function.
//!
//! The Linux kernel configuration option `CONFIG_USB_CONFIGFS_F_UVC` must be enabled.
//! It must be paired with a userspace program that responds to UVC control requests
//! and fills buffers to be queued to the V4L2 device that the driver creates.
//! See [example](https://git... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/src/function/serial.rs | src/function/serial.rs | //! Serial functions.
use std::{
ffi::{OsStr, OsString},
io::{Error, ErrorKind, Result},
path::PathBuf,
};
use super::{
util::{FunctionDir, Status},
Function, Handle,
};
/// Class of USB serial function.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum SerialClass {
///... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/src/function/hid.rs | src/function/hid.rs | //! Human interface device (HID) function.
//!
//! The Linux kernel configuration option `CONFIG_USB_CONFIGFS_F_HID` must be enabled.
use std::{
ffi::OsString,
io::{Error, ErrorKind, Result},
};
use super::{
util::{FunctionDir, Status},
Function, Handle,
};
/// Builder for USB human interface device ... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/src/function/printer.rs | src/function/printer.rs | //! Printer function.
//!
//! The Linux kernel configuration option `CONFIG_USB_CONFIGFS_F_PRINTER` must be enabled.
//!
//! A device file at `/dev/g_printerN` will be created for each instance of the function, where N
//! instance number. See `examples/printer.rs` for an example.
use bitflags::bitflags;
use std::{ffi... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/src/function/util.rs | src/function/util.rs | //! Utils for implementing USB gadget functions.
use std::{
collections::HashMap,
ffi::{OsStr, OsString},
fmt, fs,
io::{Error, ErrorKind, Result},
os::unix::prelude::{OsStrExt, OsStringExt},
path::{Component, Path, PathBuf},
sync::{Arc, Mutex, MutexGuard, Once, OnceLock},
};
use crate::{fu... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/src/function/mod.rs | src/function/mod.rs | //! USB gadget functions.
pub mod audio;
pub mod custom;
pub mod hid;
pub mod midi;
pub mod msd;
pub mod net;
pub mod other;
pub mod printer;
pub mod serial;
pub mod util;
pub mod video;
use std::{cmp, hash, hash::Hash, sync::Arc};
use self::util::{register_remove_handler, Function};
/// USB gadget function handle.... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/src/function/other.rs | src/function/other.rs | //! Other USB function.
use std::{
collections::HashMap,
ffi::{OsStr, OsString},
io::{Error, ErrorKind, Result},
os::unix::prelude::OsStrExt,
path::{Component, Path, PathBuf},
};
use super::{
util::{FunctionDir, Status},
Function, Handle,
};
/// Builder for other USB function implemented ... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/src/function/msd.rs | src/function/msd.rs | //! Mass Storage Device (MSD) function.
//!
//! The Linux kernel configuration option `CONFIG_USB_CONFIGFS_MASS_STORAGE` must be enabled.
use std::{
ffi::{OsStr, OsString},
fs,
io::{Error, ErrorKind, Result},
os::unix::prelude::OsStrExt,
path::{Path, PathBuf},
};
use super::{
util::{FunctionDi... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/src/function/midi.rs | src/function/midi.rs | //! Musical Instrument Digital Interface (MIDI) function.
//!
//! The Linux kernel configuration option `CONFIG_USB_CONFIGFS_F_MIDI` must be enabled.
//! Can use `amidi -l` once the gadget is configured to list the MIDI devices.
//!
//! # Example
//!
//! ```no_run
//! use usb_gadget::function::midi::Midi;
//! use usb_g... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/src/function/audio.rs | src/function/audio.rs | //! USB Audio Class 2 (UAC2) function.
//!
//! The Linux kernel configuration option `CONFIG_USB_CONFIGFS_F_UAC2` must be enabled.
//!
//! # Example
//!
//! ```no_run
//! use usb_gadget::function::audio::{Uac2, Channel};
//! use usb_gadget::{default_udc, Class, Config, Gadget, Id, Strings};
//!
//! // capture: 8 ch, 48... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/src/function/net.rs | src/function/net.rs | //! Net functions.
use macaddr::MacAddr6;
use std::{
ffi::{OsStr, OsString},
io::{Error, ErrorKind, Result},
};
use super::{
util::{FunctionDir, Status},
Function, Handle,
};
use crate::{gadget::Class, hex_u8};
/// Class of USB network device.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaus... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/src/function/custom/ffs.rs | src/function/custom/ffs.rs | //! FunctionFS bindings.
use bitflags::bitflags;
use byteorder::{ReadBytesExt, WriteBytesExt, LE};
use nix::{
ioctl_none, ioctl_read, ioctl_write_int_bad,
mount::{MntFlags, MsFlags},
request_code_none,
};
use std::{
collections::HashMap,
ffi::OsStr,
fmt,
io::{ErrorKind, Read, Write},
nu... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/src/function/custom/mod.rs | src/function/custom/mod.rs | //! Custom USB interface, implemented in user code.
//!
//! The Linux kernel configuration option `CONFIG_USB_CONFIGFS_F_FS` must be enabled.
use bytes::{Bytes, BytesMut};
use nix::poll::{poll, PollFd, PollFlags, PollTimeout};
use proc_mounts::MountIter;
use std::{
collections::{hash_map::Entry, HashMap, HashSet},... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | true |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/src/function/custom/aio/mod.rs | src/function/custom/aio/mod.rs | //! Linux AIO driver.
use bytes::{Bytes, BytesMut};
use nix::sys::eventfd::{self, EfdFlags};
use std::{
collections::{hash_map::Entry, HashMap, VecDeque},
fmt,
io::{Error, ErrorKind, Result},
mem::{self, MaybeUninit},
ops::Deref,
os::fd::{AsRawFd, RawFd},
pin::Pin,
ptr,
sync::{mpsc,... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/src/function/custom/aio/sys.rs | src/function/custom/aio/sys.rs | //! Linux-native AIO interface.
use libc::{
c_int, c_long, c_uint, c_ulong, syscall, timespec, SYS_io_cancel, SYS_io_destroy, SYS_io_getevents,
SYS_io_setup, SYS_io_submit,
};
use std::{
io::{Error, Result},
os::fd::RawFd,
};
/// AIO context.
pub type ContextId = c_ulong;
/// Opcodes for [`IoCb::opco... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/tests/video.rs | tests/video.rs | mod common;
use common::*;
use usb_gadget::function::video::{ColorMatching, Format, Frame, Uvc};
#[test]
fn video() {
init();
let mut builder = Uvc::builder().with_frames(vec![
Frame::new(640, 360, vec![15, 30, 60, 120], Format::Yuyv),
Frame::new(640, 360, vec![15, 30, 60, 120], Format::Mjpeg... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/tests/udc.rs | tests/udc.rs | mod common;
use common::*;
#[test]
fn query_udcs() {
init();
let udcs = usb_gadget::udcs().unwrap();
println!("USB device controllers:\n{:#?}", &udcs);
for udc in udcs {
println!("Name: {}", udc.name().to_string_lossy());
println!("OTG: {:?}", udc.is_otg().unwrap());
println!(... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/tests/serial.rs | tests/serial.rs | use std::os::unix::prelude::FileTypeExt;
use usb_gadget::function::serial::{Serial, SerialClass};
mod common;
use common::*;
fn serial(serial_class: SerialClass) {
init();
let _mutex = exclusive();
let mut builder = Serial::builder(serial_class);
builder.console = Some(false);
let (serial, func)... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/tests/hid.rs | tests/hid.rs | mod common;
use common::*;
use usb_gadget::function::hid::Hid;
#[test]
fn hid() {
init();
// Keyboard HID description
let mut builder = Hid::builder();
builder.protocol = 1;
builder.sub_class = 1;
builder.report_len = 8;
builder.report_desc = vec![
0x05, 0x01, 0x09, 0x06, 0xa1, 0x... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/tests/printer.rs | tests/printer.rs | mod common;
use common::*;
use usb_gadget::function::printer::Printer;
#[test]
fn printer() {
init();
// Keyboard printer description
let mut builder = Printer::builder();
builder.pnp_string = Some("Rust Printer".to_string());
builder.qlen = Some(20);
let (printer, func) = builder.build();
... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/tests/other.rs | tests/other.rs | mod common;
use common::*;
use usb_gadget::function::other::Other;
#[test]
fn other_ecm() {
init();
let dev_addr = "66:f9:7d:f2:3e:2a";
let mut builder = Other::builder("ecm").unwrap();
builder.set("dev_addr", dev_addr).unwrap();
let (other, func) = builder.build();
let reg = reg(func);
... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/tests/msd.rs | tests/msd.rs | mod common;
use common::*;
use std::{io::Write, thread::sleep, time::Duration};
use tempfile::NamedTempFile;
use usb_gadget::function::msd::{Lun, Msd};
#[test]
fn msd() {
init();
let mut file1 = NamedTempFile::new().unwrap();
file1.write_all(&vec![1; 1_048_576]).unwrap();
let path1 = file1.into_temp... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/tests/midi.rs | tests/midi.rs | mod common;
use common::*;
use usb_gadget::function::midi::Midi;
#[test]
fn midi() {
init();
let mut builder = Midi::builder();
builder.id = Some("midi".to_string());
builder.in_ports = Some(1);
builder.out_ports = Some(1);
let (midi, func) = builder.build();
let reg = reg(func);
pr... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/tests/audio.rs | tests/audio.rs | mod common;
use common::*;
use usb_gadget::function::audio::{Channel, Uac2};
#[test]
fn audio() {
init();
let (audio, func) = Uac2::new(Channel::new(0b1111_1111, 48000, 24 / 8), Channel::new(0b11, 48000, 16 / 8));
let reg = reg(func);
println!("UAC2 audio device at {}", audio.status().path().unwrap(... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/tests/net.rs | tests/net.rs | mod common;
use common::*;
use macaddr::MacAddr6;
use usb_gadget::function::net::{Net, NetClass};
fn net(net_class: NetClass) {
init();
let _mutex = exclusive();
let dev_addr = MacAddr6::new(0x66, 0xf9, 0x7d, 0xf2, 0x3e, 0x2a);
let host_addr = MacAddr6::new(0x7e, 0x21, 0xb2, 0xcb, 0xd4, 0x51);
l... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/tests/gadget.rs | tests/gadget.rs | mod common;
use common::*;
#[test]
fn registered_gadgets() {
init();
let _mutex = exclusive();
let reg = usb_gadget::registered().unwrap();
for gadget in reg {
println!("Gadget {gadget:?} at {}", gadget.path().display());
println!("UDC: {:?}", gadget.udc().unwrap());
println!()... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/tests/custom.rs | tests/custom.rs | use std::{thread, time::Duration};
use uuid::uuid;
use usb_gadget::{
default_udc,
function::custom::{Custom, Endpoint, EndpointDirection, Interface, OsExtCompat, OsExtProp},
Class,
};
mod common;
use common::*;
#[test]
fn custom() {
init();
let _mutex = exclusive();
let (mut ep1_rx, ep1_dir)... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/tests/common/mod.rs | tests/common/mod.rs | //! Common test functions.
#![allow(dead_code)]
use std::{
env,
io::Result,
sync::{Mutex, MutexGuard, Once},
thread::sleep,
time::Duration,
};
use usb_gadget::{
default_udc, function::Handle, registered, Class, Config, Gadget, Id, OsDescriptor, RegGadget, Strings,
WebUsb,
};
pub fn init()... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/examples/custom_interface_device_split.rs | examples/custom_interface_device_split.rs | //! Device-side example for USB gadget with custom interface.
//! This example follows the custom_interface_device.rs, but also
//! demonstrates how it is possible to run the privileged parts of
//! gadget setup (interacting with ConfigFS) in a different process to
//! the custom function parts (FunctionFS). This examp... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/examples/printer.rs | examples/printer.rs | //! Printer example userspace application based on [prn_example](https://docs.kernel.org/6.6/usb/gadget_printer.html#example-code)
//!
//! Creates and binds a printer gadget function, then reads data from the device file created by the
//! gadget to stdout. Will exit after printing a set number of pages.
use nix::{ioc... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/examples/custom_interface_device_async.rs | examples/custom_interface_device_async.rs | //! Device-side example for USB gadget with custom interface using async IO.
use bytes::BytesMut;
use std::{
sync::{
atomic::{AtomicBool, Ordering},
Arc,
},
time::Duration,
};
use usb_gadget::{
default_udc,
function::custom::{Custom, Endpoint, EndpointDirection, Event, Interface},
... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/examples/custom_interface_host.rs | examples/custom_interface_host.rs | //! Host-side example for USB gadget with custom interface.
use std::{thread, time::Duration};
use rusb::{open_device_with_vid_pid, request_type, Direction, RequestType};
fn main() {
let hnd = open_device_with_vid_pid(6, 0x11).expect("USB device not found");
let dev = hnd.device();
println!("device opene... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
surban/usb-gadget | https://github.com/surban/usb-gadget/blob/d5823aade2c4d1718b9b229435dceac44e812dce/examples/custom_interface_device.rs | examples/custom_interface_device.rs | //! Device-side example for USB gadget with custom interface.
use bytes::BytesMut;
use std::{
io::ErrorKind,
sync::{
atomic::{AtomicBool, Ordering},
Arc,
},
thread,
time::Duration,
};
use usb_gadget::{
default_udc,
function::custom::{Custom, Endpoint, EndpointDirection, Eve... | rust | Apache-2.0 | d5823aade2c4d1718b9b229435dceac44e812dce | 2026-01-04T20:23:22.416925Z | false |
phantomzone-org/phantom-zone | https://github.com/phantomzone-org/phantom-zone/blob/a8e6c276273bbe2cb7f2508ba07d1d192a467c13/src/random.rs | src/random.rs | use std::cell::RefCell;
use itertools::izip;
use num_traits::{FromPrimitive, PrimInt, Zero};
use rand::{distributions::Uniform, Rng, RngCore, SeedableRng};
use rand_chacha::ChaCha8Rng;
use rand_distr::{uniform::SampleUniform, Distribution};
use crate::{backend::Modulus, utils::WithLocal};
thread_local! {
pub(cra... | rust | MIT | a8e6c276273bbe2cb7f2508ba07d1d192a467c13 | 2026-01-04T20:23:25.934339Z | false |
phantomzone-org/phantom-zone | https://github.com/phantomzone-org/phantom-zone/blob/a8e6c276273bbe2cb7f2508ba07d1d192a467c13/src/lib.rs | src/lib.rs | use num_traits::Zero;
mod backend;
mod bool;
mod decomposer;
mod lwe;
mod multi_party;
mod ntt;
mod pbs;
mod random;
mod rgsw;
#[cfg(any(feature = "interactive_mp", feature = "non_interactive_mp"))]
mod shortint;
mod utils;
pub use backend::{
ArithmeticLazyOps, ArithmeticOps, ModInit, ModularOpsU64, ShoupMatrixFM... | rust | MIT | a8e6c276273bbe2cb7f2508ba07d1d192a467c13 | 2026-01-04T20:23:25.934339Z | false |
phantomzone-org/phantom-zone | https://github.com/phantomzone-org/phantom-zone/blob/a8e6c276273bbe2cb7f2508ba07d1d192a467c13/src/decomposer.rs | src/decomposer.rs | use itertools::{izip, Itertools};
use num_traits::{FromPrimitive, PrimInt, ToPrimitive, WrappingAdd, WrappingSub};
use std::fmt::{Debug, Display};
use crate::{
backend::ArithmeticOps,
parameters::{
DecompositionCount, DecompostionLogBase, DoubleDecomposerParams, SingleDecomposerParams,
},
utils... | rust | MIT | a8e6c276273bbe2cb7f2508ba07d1d192a467c13 | 2026-01-04T20:23:25.934339Z | false |
phantomzone-org/phantom-zone | https://github.com/phantomzone-org/phantom-zone/blob/a8e6c276273bbe2cb7f2508ba07d1d192a467c13/src/lwe.rs | src/lwe.rs | use std::fmt::Debug;
use itertools::izip;
use num_traits::Zero;
use crate::{
backend::{ArithmeticOps, GetModulus, VectorOps},
decomposer::Decomposer,
random::{RandomFillUniformInModulus, RandomGaussianElementInModulus},
utils::TryConvertFrom1,
Matrix, Row, RowEntity, RowMut,
};
pub(crate) fn lwe_... | rust | MIT | a8e6c276273bbe2cb7f2508ba07d1d192a467c13 | 2026-01-04T20:23:25.934339Z | false |
phantomzone-org/phantom-zone | https://github.com/phantomzone-org/phantom-zone/blob/a8e6c276273bbe2cb7f2508ba07d1d192a467c13/src/utils.rs | src/utils.rs | use std::{usize, vec};
use itertools::{izip, Itertools};
use num_traits::{One, PrimInt, Signed};
use crate::{
backend::Modulus,
decomposer::NumInfo,
random::{RandomElementInModulus, RandomFill},
Matrix, RowEntity, RowMut,
};
pub trait WithLocal {
fn with_local<F, R>(func: F) -> R
where
... | rust | MIT | a8e6c276273bbe2cb7f2508ba07d1d192a467c13 | 2026-01-04T20:23:25.934339Z | false |
phantomzone-org/phantom-zone | https://github.com/phantomzone-org/phantom-zone/blob/a8e6c276273bbe2cb7f2508ba07d1d192a467c13/src/ntt.rs | src/ntt.rs | use itertools::{izip, Itertools};
use rand::{Rng, RngCore, SeedableRng};
use rand_chacha::ChaCha8Rng;
use crate::{
backend::{ArithmeticOps, ModInit, ModularOpsU64, Modulus},
utils::{mod_exponent, mod_inverse, ShoupMul},
};
pub trait NttInit<M> {
/// Ntt istance must be compatible across different instance... | rust | MIT | a8e6c276273bbe2cb7f2508ba07d1d192a467c13 | 2026-01-04T20:23:25.934339Z | false |
phantomzone-org/phantom-zone | https://github.com/phantomzone-org/phantom-zone/blob/a8e6c276273bbe2cb7f2508ba07d1d192a467c13/src/multi_party.rs | src/multi_party.rs | use std::fmt::Debug;
use itertools::izip;
use num_traits::Zero;
use crate::{
backend::{GetModulus, Modulus, VectorOps},
ntt::Ntt,
random::{
RandomFillGaussianInModulus, RandomFillUniformInModulus, RandomGaussianElementInModulus,
},
utils::TryConvertFrom1,
ArithmeticOps, Matrix, MatrixE... | rust | MIT | a8e6c276273bbe2cb7f2508ba07d1d192a467c13 | 2026-01-04T20:23:25.934339Z | false |
phantomzone-org/phantom-zone | https://github.com/phantomzone-org/phantom-zone/blob/a8e6c276273bbe2cb7f2508ba07d1d192a467c13/src/main.rs | src/main.rs | fn main() {}
| rust | MIT | a8e6c276273bbe2cb7f2508ba07d1d192a467c13 | 2026-01-04T20:23:25.934339Z | false |
phantomzone-org/phantom-zone | https://github.com/phantomzone-org/phantom-zone/blob/a8e6c276273bbe2cb7f2508ba07d1d192a467c13/src/pbs.rs | src/pbs.rs | use std::fmt::Display;
use num_traits::{FromPrimitive, One, PrimInt, ToPrimitive, Zero};
use crate::{
backend::{ArithmeticOps, Modulus, ShoupMatrixFMA, VectorOps},
decomposer::{Decomposer, RlweDecomposer},
lwe::lwe_key_switch,
ntt::Ntt,
rgsw::{
rlwe_auto_shoup, rlwe_by_rgsw_shoup, RgswCiph... | rust | MIT | a8e6c276273bbe2cb7f2508ba07d1d192a467c13 | 2026-01-04T20:23:25.934339Z | false |
phantomzone-org/phantom-zone | https://github.com/phantomzone-org/phantom-zone/blob/a8e6c276273bbe2cb7f2508ba07d1d192a467c13/src/rgsw/keygen.rs | src/rgsw/keygen.rs | use std::{fmt::Debug, ops::Sub};
use itertools::izip;
use num_traits::{PrimInt, Signed, ToPrimitive, Zero};
use crate::{
backend::{ArithmeticOps, GetModulus, Modulus, VectorOps},
ntt::Ntt,
random::{
RandomElementInModulus, RandomFill, RandomFillGaussianInModulus, RandomFillUniformInModulus,
},... | rust | MIT | a8e6c276273bbe2cb7f2508ba07d1d192a467c13 | 2026-01-04T20:23:25.934339Z | false |
phantomzone-org/phantom-zone | https://github.com/phantomzone-org/phantom-zone/blob/a8e6c276273bbe2cb7f2508ba07d1d192a467c13/src/rgsw/runtime.rs | src/rgsw/runtime.rs | use itertools::izip;
use num_traits::Zero;
use crate::{
backend::{ArithmeticOps, GetModulus, ShoupMatrixFMA, VectorOps},
decomposer::{Decomposer, RlweDecomposer},
ntt::Ntt,
parameters::{DecompositionCount, DoubleDecomposerParams, SingleDecomposerParams},
Matrix, MatrixEntity, MatrixMut, Row, RowEnt... | rust | MIT | a8e6c276273bbe2cb7f2508ba07d1d192a467c13 | 2026-01-04T20:23:25.934339Z | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.