Crate veilid_tools
source ·Expand description
§Veilid Tools
A collection of baseline tools for Rust development use by Veilid and Veilid-enabled Rust applications
These are used by veilid-core
, veilid-server
, veilid-cli
and may be used by any other applications
that link in veilid-core
if a common baseline of functionality is desired. Extending this crate with new
utility functions is encouraged rather than adding ‘common’ functionality to veilid-core
, allowing it to
remain free of boilerplate and utility classes that could be reused elsewhere.
Everything added to this crate must be extensively unit-tested.
§Features
The default veilid-tools
configurations are:
default
- Usestokio
as the async runtime
If you use --no-default-features
, you can switch to other runtimes:
rt-async-std
- Usesasync-std
as the async runtimert-wasm-bindgen
- When building for thewasm32
architecture, use this to enablewasm-bindgen-futures
as the async runtime
Re-exports§
pub use std::borrow::Cow;
pub use std::borrow::ToOwned;
pub use std::boxed::Box;
pub use std::cell::RefCell;
pub use std::cmp;
pub use std::collections::btree_map::BTreeMap;
pub use std::collections::btree_set::BTreeSet;
pub use std::collections::hash_map::HashMap;
pub use std::collections::hash_set::HashSet;
pub use std::collections::LinkedList;
pub use std::collections::VecDeque;
pub use std::convert::TryFrom;
pub use std::convert::TryInto;
pub use std::fmt;
pub use std::future::Future;
pub use std::mem;
pub use std::net::IpAddr;
pub use std::net::Ipv4Addr;
pub use std::net::Ipv6Addr;
pub use std::net::SocketAddr;
pub use std::net::SocketAddrV4;
pub use std::net::SocketAddrV6;
pub use std::net::ToSocketAddrs;
pub use std::ops::Fn;
pub use std::ops::FnMut;
pub use std::ops::FnOnce;
pub use std::pin::Pin;
pub use std::rc::Rc;
pub use std::str::FromStr;
pub use std::string::String;
pub use std::string::ToString;
pub use std::sync::atomic::AtomicBool;
pub use std::sync::atomic::AtomicUsize;
pub use std::sync::atomic::Ordering;
pub use std::sync::Arc;
pub use std::sync::Weak;
pub use std::task;
pub use std::time::Duration;
pub use std::vec::Vec;
pub use async_lock::RwLock as AsyncRwLock;
pub use async_lock::RwLockReadGuard as AsyncRwLockReadGuard;
pub use async_lock::RwLockWriteGuard as AsyncRwLockWriteGuard;
pub use tokio::sync::Mutex as AsyncMutex;
pub use tokio::sync::MutexGuard as AsyncMutexGuard;
pub use tokio::sync::OwnedMutexGuard as AsyncMutexGuardArc;
pub use tokio::task::JoinHandle as LowLevelJoinHandle;
pub use fn_name;
Modules§
- Packet reassembly and fragmentation handler
Macros§
Structs§
- Some of the flags associated with an address.
- Packet reassembly and fragmentation handler
- Background processor for streams Handles streams to completion, passing each item from the stream to a callback
- Details about the ipv4 address of an interface on this host.
- Details about the ipv6 address of an interface on this host.
- Some of the flags associated with an interface.
- Spawns a single background processing task idempotently, possibly returning the return value of the previously executed background task This does not queue, just ensures that no more than a single copy of the task is running at a time, but allowing tasks to be retriggered
- Synchronization mechanism that tracks the startup and shutdown of a region of code. Guarantees that some code can only be started up once and shut down only if it is already started. Also tracks if the code is in-use and will wait for all ‘entered’ code to finish before shutting down. Once a shutdown is requested, future calls to ‘enter’ will fail, ensuring that nothing is ‘entered’ at the time of shutdown. This allows an asynchronous shutdown to wait for operations to finish before proceeding.
- RAII-style lock for entry operations on a started-up region of code.
- RAII-style lock for startup and shutdown operations Must call ‘success()’ on this lock to report a successful startup or shutdown Dropping this lock without calling ‘success()’ first indicates a failed startup or shutdown operation
- Runs a single-future background processing task, attempting to run it once every ‘tick period’ microseconds. If the prior tick is still running, it will allow it to finish, and do another tick when the timer comes around again. One should attempt to make tasks short-lived things that run in less than the tick period if you want things to happen with regular periodicity.
Enums§
Constants§
- The hard-coded maximum fragment size used by AssemblyBuffer
Traits§
- Dedup, but doesn’t require a sorted vec, and keeps the element order
Functions§
- Safety
- Safety