drop
import std::core::drop; — in the prelude · source
Types
Drop
type trait Drop {
drop(mut &this) -> void;
}
Drop is the destructor: drop(mut &this) -> void, the last operation performed on a value. The compiler synthesises the call at scope exit - including the early exits ? and return take - and a manual .drop() remains available for early release. See Ownership, Copy, and Drop for when the call is inserted and what a move does to it.
Every primitive gets a trivial no-op impl so generic containers can write where K: Drop, V: Drop without locking out useful instantiations like HashMap<u32, V>; when the value carries no resource, the call lowers to no IR at all. The unit type () has one for the same reason - HashSet<T> is a HashMap<T, ()>.
The module is in the prelude because an implement trait Drop for X head has to resolve the trait name in every file that owns a resource, and the compiler reasons about Drop by identity rather than by spelling.
Methods
drop(mut &this) -> void;
Implementors
Every owning type in the library. The primitive impls are the no-ops described above; the 128-bit and pointer-width integers have no explicit impl and need none.
implement trait Drop for i8
implement trait Drop for i16
implement trait Drop for i32
implement trait Drop for i64
implement trait Drop for u8
implement trait Drop for u16
implement trait Drop for u32
implement trait Drop for u64
implement trait Drop for f32
implement trait Drop for f64
implement trait Drop for boolean
implement trait Drop for char
implement trait Drop for string
implement trait Drop for ()
implement<T, A> trait Drop for struct Arc<T, A> where A: Allocator
std::alloc::arc
implement<T, A> trait Drop for struct Weak<T, A> where A: Allocator
std::alloc::arc
implement trait Drop for struct Arena
std::alloc::arena_alloc
implement<T, A> trait Drop for struct Box<T, A> where A: Allocator
std::alloc::box
implement trait Drop for struct Pool
std::alloc::pool
implement<T, A> trait Drop for struct Rc<T, A> where A: Allocator
std::alloc::rc
implement<T, A> trait Drop for struct Weak<T, A> where A: Allocator
std::alloc::rc
implement<T, A> trait Drop for struct Array<T, A> where T: Drop, A: Allocator
std::collections::array
implement<K, V, A> trait Drop for struct HashMap<K, V, A> where A: Allocator
std::collections::hashmap
implement<T, A> trait Drop for struct HashSet<T, A> where A: Allocator
std::collections::hashset
implement<A, B> trait Drop for struct Pair<A, B>
std::collections::pair
implement<T, A> trait Drop for struct RawBuffer<T, A> where A: Allocator
std::collections::raw_buffer
implement<A> trait Drop for struct String<A> where A: Allocator
std::collections::string
implement trait Drop for VaArgs
std::core::varargs
implement trait Drop for struct BodyText
std::fmt::spec
implement trait Drop for struct DirEntry
std::fs::dir
implement trait Drop for struct ReadDir
std::fs::dir
implement trait Drop for struct File
std::fs::file
implement<A> trait Drop for struct PathBuf<A> where A: Allocator
std::fs::path
implement trait Drop for struct Task
std::future::executor
implement<O> trait Drop for struct JoinHandle<O>
std::future::executor
implement trait Drop for struct Executor
std::future::executor
implement trait Drop for struct Sleep
std::future::timer
implement trait Drop for struct Waker
std::future::waker
implement<W> trait Drop for struct BufWriter<W>
std::io::buf
implement<W> trait Drop for struct LineWriter<W>
std::io::buf
implement<R> trait Drop for struct BufReader<R>
std::io::buf
implement<S> trait Drop for struct BufStream<S>
std::io::buf
implement trait Drop for struct Cursor
std::io::cursor
implement trait Drop for struct StdinLock
std::io::stdio
implement trait Drop for struct StdoutLock
std::io::stdio
implement trait Drop for struct StderrLock
std::io::stdio
implement trait Drop for struct JsonError
std::json::error
implement trait Drop for struct JsonObject
std::json::value
implement trait Drop for enum JsonValue
std::json::value
implement trait Drop for struct ResolvedAddrs
std::net::dns
implement trait Drop for struct Resolve
std::net::dns
implement<S> trait Drop for struct Http2Connection<S>
std::net::http2::connection
implement trait Drop for struct Frame
std::net::http2::frame
implement trait Drop for struct HeaderField
std::net::http2::hpack
implement trait Drop for struct DynTable
std::net::http2::hpack
implement trait Drop for struct HpackDecoder
std::net::http2::hpack
implement trait Drop for struct HpackEncoder
std::net::http2::hpack
implement trait Drop for struct HuffTree
std::net::http2::huffman
implement trait Drop for struct Http2Server
std::net::http2::server
implement trait Drop for struct Headers
std::net::http::headers
implement trait Drop for struct Request
std::net::http::request
implement trait Drop for struct Response
std::net::http::response
implement trait Drop for struct Route
std::net::http::router
implement trait Drop for struct Router
std::net::http::router
implement trait Drop for struct HttpsClient
std::net::https
implement trait Drop for struct TcpStream
std::net::socket::tcp
implement trait Drop for struct TcpListener
std::net::socket::tcp
implement trait Drop for struct TcpRead
std::net::socket::tcp
implement trait Drop for struct TcpWrite
std::net::socket::tcp
implement trait Drop for struct TcpAccept
std::net::socket::tcp
implement trait Drop for struct TcpConnect
std::net::socket::tcp
implement trait Drop for struct UdpSocket
std::net::socket::udp
implement trait Drop for struct UdpSendTo
std::net::socket::udp
implement trait Drop for struct UdpSend
std::net::socket::udp
implement trait Drop for struct UdpRecvFrom
std::net::socket::udp
implement trait Drop for struct UdpRecv
std::net::socket::udp
implement trait Drop for struct TlsConnector
std::net::tls::context
implement trait Drop for struct TlsAcceptor
std::net::tls::context
implement trait Drop for struct TlsHandshake
std::net::tls::future
implement trait Drop for struct TlsRead
std::net::tls::future
implement trait Drop for struct TlsWrite
std::net::tls::future
implement trait Drop for struct TlsStream
std::net::tls::stream
implement<S> trait Drop for struct WebSocket<S>
std::net::ws::conn
implement trait Drop for struct Frame
std::net::ws::frame
implement trait Drop for struct ChildWait
std::process::child
implement trait Drop for struct PipeDrain
std::process::child
implement trait Drop for struct ChildStdin
std::process::child
implement trait Drop for struct ChildStdout
std::process::child
implement trait Drop for struct ChildStderr
std::process::child
implement trait Drop for struct Child
std::process::child
implement trait Drop for struct ArgvBuf
std::process::command
implement trait Drop for struct EnvEntry
std::process::command
implement trait Drop for struct Command
std::process::command
implement trait Drop for struct Output
std::process::command
implement trait Drop for struct PipePair
std::process::command
implement trait Drop for struct WinStdio
std::process::command
implement trait Drop for struct WeightedIndex
std::random::distribution
implement<T> trait Drop for struct Atomic<T>
std::sync::atomic
implement trait Drop for struct Barrier
std::sync::barrier
implement trait Drop for struct CondVar
std::sync::condvar
implement<T> trait Drop for struct Sender<T>
std::sync::mpsc
implement<T> trait Drop for struct Receiver<T>
std::sync::mpsc
implement<T, A> trait Drop for struct MutexGuard<T, A>
std::sync::mutex
implement<T, A> trait Drop for struct Mutex<T, A> where A: Allocator
std::sync::mutex
implement trait Drop for struct Once
std::sync::once
implement<T, A> trait Drop for struct RwLockReadGuard<T, A>
std::sync::rwlock
implement<T, A> trait Drop for struct RwLockWriteGuard<T, A>
std::sync::rwlock
implement<T, A> trait Drop for struct RwLock<T, A> where A: Allocator
std::sync::rwlock
implement trait Drop for enum TestError
std::test::error
implement trait Drop for struct RunOptions
std::test::runner
implement trait Drop for struct TestRun
std::test::runner
implement trait Drop for struct ReporterState
std::test::runner
implement trait Drop for struct WorkerResult
std::test::runner
implement trait Drop for struct TestRunner
std::test::runner
implement<T> trait Drop for struct JoinHandle<T>
std::thread
implement trait Drop for struct Scope
std::thread
implement<T> trait Drop for struct ThreadLocal<T>
std::thread::local
type struct Name { ... }
type enum Name { ... }
type trait Name { ... }
type union Name { ... }Begins a type declaration; the keyword that follows says which kind. On its own, type Name = Existing; declares an alias.
type trait Name : Base {
method(&this, other: &This) -> Ret;
}Names a set of methods a type may implement. Inside the body This is the implementing type; methods may carry default bodies, and a trait may require a base trait (type trait Ord : Eq). Generic code asks for a trait with where T: Name.
type trait Drop {
drop(mut &this) -> void;
}Drop: explicit destructor.
Drop::drop(mut &this) -> voidmut &this
mut &TypeAn exclusive, mutating borrow. As a receiver, mut &this lets the method modify the fields - and callers can see that from the signature alone. As a parameter type, mut &T lets the callee mutate through the reference while the caller keeps ownership.
&this
mut &this
thisThe receiver of a method. Its first parameter declares how the method takes it: &this borrows read-only, mut &this borrows exclusively, and this / mut this move the value in and consume it. In the body, this.field reaches the members.
import a::b;
import a::b::{ X, Y };
import a::b as c;
import a::b::*;Brings a module, or selected items from it, into scope. One path per declaration: use the brace form for several items, as to alias, and * for everything public (prefer the brace form; wildcards invite name collisions).
Drop::drop(mut &this) -> voidreturn value;Leaves the current function with the given value. A function whose return type is not void must return one; a bare return; is for void. In an async function it completes the future with the value.
where T: Ord + Clone, U: HashConstrains generic parameters to types that implement the listed traits, which is what makes those traits' methods callable on T. Bounds on one parameter join with +; parameters separate with ,. A where on a single method narrows the type's parameter for that method only.
type struct HashMap<K, V, A = GlobalAlloc> where A: Allocator {
buckets: Entry<K, V>**;
bucket_count: u64;
length: u64;
alloc: A;
seed: u64;
}HashMap<K, V, A>: key-value map with amortized O(1) operations.
std::collections::hashmaptype struct HashSet<T, A = GlobalAlloc> {
map: HashMap<T, (), A>;
}HashSet<T, A>: unordered collection of unique values.
std::collections::hashsetprimitive ()The unit type: a value that carries no information, and the empty tuple. Distinct from void, which is the absence of a value - Result<(), E> succeeds with nothing to return. 0 bytes.
implement struct Name { ... }
implement trait Trait for Type { ... }
implement u64 { ... }Adds methods to a type outside its declaration. implement struct T (or enum, or a bare primitive) opens an inherent block; implement trait Tr for T supplies a trait's methods for one type. Resolution is at compile time - no dynamic dispatch.
implement trait Trait for Type { ... }Introduces a trait implementation: the block supplies, for one concrete type, the method bodies the trait requires.
language referenceimplement trait Trait for Type { ... }Names the type a trait implementation is for. The block that follows supplies the bodies the trait requires.
language referenceprimitive stringNUL-terminated raw string (u8*), matching the C ABI. Length-typed text is Str / String.
type parameter Ttype parameter Awhere A: Allocator
type struct Name {
field: Type;
method(&this) -> Ret { ... }
}A value type with named fields and optional methods. Structs live on the stack and are passed by value. Fields are public by default and may carry = default values; methods take their receiver as &this, mut &this, or this.
type struct Arc<T, A = GlobalAlloc> where A: Allocator {
inner: ArcInner<T, A>*;
}Arc<T, A>: atomic reference counting, with weak references.
std::alloc::arctype trait Allocator {
allocate(mut &this, layout: Layout) -> Result<NonNull<u8>, AllocError>;
deallocate(mut &this, ptr: NonNull<u8>, layout: Layout) -> void;
reallocate(mut &this, ptr: NonNull<u8>, old_layout: Layout, new_layout: Layout) -> Result<NonNull<u8>, AllocError>;
}Allocator: the trait every heap strategy implements.
std::alloc::allocatortype struct Weak<T, A = GlobalAlloc> {
inner: RcInner<T, A>*;
}A non-owning reference to an Rc-managed value. Obtain one with Rc::downgrade; recover a strong Rc (if the value still lives) with upgrade. Holding a Weak keeps the header mapped but not the value, which is what makes it safe to store the back-edge of a cycle here.
type struct Arena {
head: Chunk*;
current: Chunk*;
chunk_size: u64;
}Arena: bump allocator with bulk release.
std::alloc::arenatype struct Box<T, A = GlobalAlloc> where A: Allocator {
ptr: T*;
alloc: A;
}Box<T, A>: single-owner heap allocation.
std::alloc::boxtype struct Pool {
slot: Layout;
slots_per_block: u64;
free_list: FreeNode*;
blocks: Block*;
}Pool: O(1) allocator for uniformly-sized slots.
std::alloc::pooltype struct Rc<T, A = GlobalAlloc> where A: Allocator {
inner: RcInner<T, A>*;
}Rc<T, A>: single-threaded reference counting, with weak references.
std::alloc::rctype parameter Twhere T: Drop
type struct Array<T, A = GlobalAlloc> where A: Allocator {
ptr: T*;
length: i64;
capacity: i64;
alloc: A;
}Array<T, A>: growable, heap-backed, contiguous sequence.
std::collections::arraytype parameter Ktype parameter Vtype parameter Atype parameter Btype struct Pair<A, B> {
first: A;
second: B;
}Pair<A, B>: an owned two-element tuple.
std::collections::pairtype struct RawBuffer<T, A = GlobalAlloc> where A: Allocator {
ptr: T*;
capacity: u64;
alloc: A;
}RawBuffer: the allocator-backed storage half of a growable container.
std::collections::raw_buffertype struct String<A = GlobalAlloc> {
buffer: RawBuffer<u8, A>;
length: u64;
}String: owned, heap-allocated, length-typed UTF-8.
std::collections::stringtype struct VaArgs {
ptr: void*;
}Single-pointer wrapper over the active va_list. ptr is the raw va_list pointer - the args identifier the compiler binds in a variadic body.
type struct BodyText {
text: String;
head_len: u64;
}The rendered digits/text of a value plus the length of its leading sign/radix-prefix run (bytes that a 0 flag must keep leftmost).
type struct DirEntry {
entry_name: String;
dtype: u8;
}One entry returned by ReadDir. Owns its name; drop releases it.
type struct ReadDir {
dirp: void*;
base: String;
}Forward iterator over the entries of a directory. Yields owned DirEntry values, skipping . and ... Closes the underlying DIR* on drop. Order is filesystem-defined.
type struct PathBuf<A = GlobalAlloc> {
inner: String<A>;
}type struct Task {
fut: u8*;
shared: u8*;
next: Task*;
exec: ExecInner*;
run_state: Atomic<u8>;
self_arc: ArcInner<Task, GlobalAlloc>*;
}A heap-boxed, type-erased task on an executor's queue. The concrete future lives in the fut box; poll_fn/drop_fn/dispose_fn are its monomorphized vtable. shared points at the TaskShared<O> (and, at offset 0, the TaskCtl).
type parameter Otype struct JoinHandle<O> {
shared: TaskShared<O>*;
exec: ExecInner*;
}JoinHandle is also declared in std::thread
A handle to a spawned task, yielding its Output via join(). Dropping a handle without join/detach detaches (the task runs on, its result discarded). abort() requests cancellation.
type struct Executor {
inner: ExecInner*;
worker_tids: [u64];
}A multi-threaded, poll-driven task executor. Construct one, spawn futures onto it (keeping the JoinHandle to await a result, or dropping it to fire-and-forget), and block_on to drive a root future to its value. A pool of worker threads does all polling; the calling thread only ever blocks on a completion condvar.
type struct Sleep {
deadline: i64;
id: u64;
rt: Reactor*;
}A future that completes once the monotonic clock reaches its deadline.
std::future::timertype struct Waker {
data: u8*;
}A handle a stalled future stores so it can be re-scheduled: wake_fn(data) tells the executor "poll my task again". This is the manual-vtable shape used throughout the runtime — non-capturing function pointers plus an opaque data pointer identifying the task.
type parameter Wtype struct BufWriter<W> where W: Write {
writer: W*;
buffer: u8*;
capacity: u64;
length: u64;
}Coalesces writes destined for W into larger flushes. The inner writer is borrowed via pointer; the caller owns it and drops it.
type struct LineWriter<W> {
inner: BufWriter<W>;
}A BufWriter that flushes after any write containing a \n. Appropriate for interactive stdout on a TTY, where "the user saw the line as soon as it was emitted" matters more than coalescing.
type parameter Rtype struct BufReader<R> where R: Read {
reader: R*;
buffer: u8*;
capacity: u64;
position: u64;
filled: u64;
}Pulls from R in buffer-sized chunks and serves reads from the buffer. Transforms a stream of small reads into a few large ones and makes read_line fast: no per-byte syscall.
type parameter Stype struct BufStream<S> {
inner: S;
rbuf: Array<u8>;
rpos: u64;
scratch: Array<u8>;
wbuf: Array<u8>;
}type struct Cursor {
buffer: Array<u8>;
pos: u64;
}Cursor is also declared in std::net::http2::hpack
An in-memory Read + Write + Seek byte buffer. Owns its Array<u8>; drop releases it (or move it out with into_inner first).
type struct StdinLock {}RAII guard over the stdin lock; reads through fd 0. Get one from stdin().lock(). Inherits the Read trait defaults (read_line, read_to_string, ...).
type struct StdoutLock {}RAII guard over the stdout lock; writes through fd 1. Get one from stdout().lock(). Inherits the Write trait default write (generic over the payload).
type struct StderrLock {}RAII guard over the stderr lock; writes through fd 2. Get one from stderr().lock().
type struct JsonError {
kind: JsonErrorKind;
line: u64;
column: u64;
offset: u64;
msg: String;
}type struct JsonObject {
keys: Array<String>;
values: Array<JsonValue>;
index: HashMap<String, u64>;
}JSON object. Insertion-ordered keys + parallel value array; a HashMap from String to slot index gives O(1) lookup. Owning; callers must drop before discarding.
type enum Name {
Unit,
Payload(T),
Named { x: i32 },
}An algebraic data type. Variants may be bare or carry a tuple or struct payload, and a match on an enum must cover every variant. Name::Variant names a variant; methods are added with implement enum Name { ... }.
type enum JsonValue {
Null;
Bool(boolean);
Number(JsonNumber);
String(String);
Array(Array<JsonValue>);
Object(JsonObject);
}One JSON value. Recursive through Array and Object.
type struct ResolvedAddrs {
addrs: Array<IpAddr>;
}The addresses a hostname resolved to. Owns the backing Array; call drop when done.
type struct Resolve {
host: Str;
job: ResolveJob*;
}Resolve host without stalling the executor: the lookup runs on the BlockingPool's threads and the task parks until it answers.
type struct Http2Connection<S> {
conn: BufStream<S>;
encoder: HpackEncoder;
decoder: HpackDecoder;
is_client: boolean;
next_stream_id: u32;
goaway_received: boolean;
remote_max_frame: u64;
remote_initial_window: i64;
conn_send_window: i64;
stream_send_window: i64;
}type struct Frame {
ftype: u8;
flags: u8;
stream_id: u32;
payload: Array<u8>;
}Frame is also declared in std::net::ws::frame
One decoded frame. Owns its payload bytes; call drop.
type struct HeaderField {
name: String;
value: String;
}One header field. Owns its name and value bytes.
std::net::http2::hpacktype struct DynTable {
entries: Array<HeaderField>;
size: u64;
max_size: u64;
}HPACK dynamic table: a FIFO of recently-seen header fields, indexed newest-first. Entry at array slot 0 is the most recent (HPACK index 62); the oldest entries are evicted when the byte budget is exceeded.
std::net::http2::hpacktype struct HpackDecoder {
table: DynTable;
hard_max: u64;
}type struct HpackEncoder {
table: DynTable;
}type struct HuffTree {
zero: Array<i32>;
one: Array<i32>;
sym: Array<i32>;
}A prefix tree over the HPACK Huffman code, for decoding. Each node has a zero/one child index (-1 = none) and a sym (-1 = internal, 0..256 = a decoded symbol; 256 is EOS and must never appear in input).
type struct Http2Server {
listener: TcpListener;
}A single-connection-at-a-time h2c (cleartext) server.
std::net::http2::servertype struct Headers {
inner: HashMap<String, String>;
}HTTP headers: case-insensitive name/value map.
std::net::http::headerstype struct Request {
method: Method;
path: String;
version: String;
headers: Headers;
body: Array<u8>;
params: HashMap<String, String>;
}HTTP request.
std::net::http::requesttype struct Response {
status: StatusCode;
version: String;
headers: Headers;
body: Array<u8>;
}HTTP response.
std::net::http::responsetype struct Route {
method: Method;
pattern: Str;
kind: RouteKind;
}A single registered route entry.
std::net::http::routertype struct Router {
routes: Array<Route>;
}Method- and path-based request dispatcher.
std::net::http::routertype struct HttpsClient {
connector: TlsConnector;
}type struct TcpStream {
fd: i32;
}type struct TcpListener {
fd: i32;
}type struct TcpRead {
stream: TcpStream;
buf: Array<u8>;
rt: Reactor*;
}Read as soon as the socket has anything to give. Completes with the byte count — 0 means the peer closed its end — or the error that ended it.
std::net::socket::tcptype struct TcpWrite {
stream: TcpStream;
buf: Array<u8>;
rt: Reactor*;
}Write as soon as the socket has room. Completes with the number of bytes accepted, which may be fewer than asked for — a caller with more to send starts another write for the remainder, which is why the buffer comes back untouched. Owns the socket and the buffer exactly as TcpRead does, and for the same reason.
type struct TcpAccept {
listener: TcpListener;
rt: Reactor*;
}Accept the next incoming connection. An accepted socket does not inherit the listener's non-blocking mode, so it is set here — it is about to be used with these same futures. Owns the listener for the duration and hands it back in the TcpAccepted, so a server loop starts the next accept from that.
type struct TcpConnect {
fd: i32;
addr: [u8;
28];
addrlen: u32;
err: IoError;
rt: Reactor*;
}Connect to a remote address without blocking. The socket is opened and the handshake started when the future is created; each poll asks the OS whether it finished, parking on writability in between. The socket is closed if the future is dropped before it completes.
std::net::socket::tcptype struct UdpSocket {
fd: i32;
}type struct UdpSendTo {
socket: UdpSocket;
buf: Array<u8>;
dest: SocketAddr;
rt: Reactor*;
}Send one datagram to dest. Completes with the number of bytes the kernel accepted; a partial datagram is never sent, so that is the whole buffer on success. The buffer comes back untouched.
type struct UdpSend {
socket: UdpSocket;
buf: Array<u8>;
rt: Reactor*;
}Send one datagram on a connected socket. Fails NotConnected if no default peer was pinned. Owns the socket and the buffer exactly as UdpSendTo does.
type struct UdpRecvFrom {
socket: UdpSocket;
buf: Array<u8>;
rt: Reactor*;
}Receive one datagram, completing with the byte count and the peer that sent it. A datagram longer than the buffer is truncated (the tail is discarded - POSIX UDP semantics).
std::net::socket::udptype struct UdpRecv {
socket: UdpSocket;
buf: Array<u8>;
rt: Reactor*;
}Receive on a connected socket, dropping the peer address - it can only be the connected peer. Truncates an oversized datagram, as UdpRecvFrom does.
type struct TlsConnector {
ctx: void*;
verify: boolean;
}type struct TlsAcceptor {
ctx: void*;
}type struct TlsHandshake {
tls: TlsStream;
is_client: boolean;
verify: boolean;
rt: Reactor*;
armed: u32;
}Drive a TLS handshake to completion without blocking. SSL_connect (client) or SSL_accept (server) is re-issued on every poll — which is exactly what OpenSSL wants after a WANT_* — until it reports success or a real failure.
type struct TlsRead {
tls: TlsStream;
buf: Array<u8>;
rt: Reactor*;
armed: u32;
}Read decrypted bytes as soon as the connection has some. Completes with the byte count — 0 means the peer sent close_notify, the TLS equivalent of EOF — or the error that ended it.
type struct TlsWrite {
tls: TlsStream;
buf: Array<u8>;
rt: Reactor*;
armed: u32;
}Write plaintext as soon as the connection has room for the resulting record. Completes with the number of bytes accepted, which may be fewer than asked for — a caller with more to send starts another write for the remainder, which is why the buffer comes back untouched.
std::net::tls::futuretype struct TlsStream {
ssl: void*;
inner: TcpStream;
}type struct WebSocket<S> {
conn: BufStream<S>;
is_client: boolean;
closed: boolean;
}type struct ChildWait {
pid: i32;
handle: u64;
exit_fd: i32;
rt: Reactor*;
job: ChildWaitJob*;
routed: boolean;
}Wait for a child to exit without stalling the executor. The machinery behind Child::join; await that rather than driving this directly, because only the method updates the Child's bookkeeping.
type struct PipeDrain {
fd: i32;
buf: Array<u8>;
rt: Reactor*;
job: PipeDrainJob*;
routed: boolean;
on_reactor: boolean;
}Read one captured pipe to EOF without stalling the executor. The machinery behind Command::collect; await that rather than driving this directly.
type struct ChildStdin {
fd: i32;
}Write end of a pipe whose read end is the child's stdin.
std::process::childtype struct ChildStdout {
fd: i32;
}Read end of a pipe whose write end is the child's stdout.
std::process::childtype struct ChildStderr {
fd: i32;
}Read end of a pipe whose write end is the child's stderr.
std::process::childtype struct Child {
stdin: Option<ChildStdin>;
stdout: Option<ChildStdout>;
stderr: Option<ChildStderr>;
}Child: a running subprocess.
std::process::childtype struct ArgvBuf {
buf: RawBuffer<u8*>;
length: u64;
}type struct EnvEntry {
key: String;
value: String;
}type struct Command {
program: String;
args: Array<String>;
envs: Array<EnvEntry>;
clear_env_flag: boolean;
cwd: Option<String>;
stdin_cfg: Stdio;
stdout_cfg: Stdio;
stderr_cfg: Stdio;
}Command: builder for spawning a subprocess.
std::process::commandtype struct Output {
status: ExitStatus;
stdout: Array<u8>;
stderr: Array<u8>;
}type struct PipePair {
read_end: i32;
write_end: i32;
}Pipe-pair struct. read_end is what the reader uses; write_end is what the writer uses. Both -1 means no pipe was created (Stdio was Inherit/Null/Fd).
type struct WinStdio {
child_handle: u8*;
parent_fd: i32;
extra_close: u8*;
close_fd: i32;
ok: boolean;
}type struct WeightedIndex {
cumulative: Array<f64>;
total: f64;
}Chooses an index 0..n with probability proportional to a weight. Built once from a weight list, then sampled cheaply. Owns its cumulative table, so it carries a drop.
type struct Atomic<T> {
value: T;
}A single atomic cell of type T. See the module docs for the supported T and the compile-time dispatch model.
type struct CondVar {
inner: CondVarInner*;
}CondVar: condition variable for blocking until a predicate holds.
std::sync::condvartype struct Sender<T> {
inner: ChannelInner<T>*;
}The sending half of a channel. Cloneable for multiple producers.
std::sync::mpsctype struct Receiver<T> {
inner: ChannelInner<T>*;
}The receiving half of a channel, and the channel's owner. Not cloneable (single consumer); mint producers with sender().
type struct MutexGuard<T, A> {
inner: MutexInner<T, A>*;
}RAII guard returned by Mutex::lock. Carries a raw pointer to the inner so it can release the lock on drop. Deref via as_ptr() to read or mutate the guarded value.
type struct Mutex<T, A = GlobalAlloc> where A: Allocator {
inner: MutexInner<T, A>*;
}Mutex<T>: mutual-exclusion lock around a value.
std::sync::mutextype struct Once {
inner: OnceInner*;
}Once: one-shot initialization synchronization.
std::sync::oncetype struct RwLockReadGuard<T, A> {
inner: RwLockInner<T, A>*;
}Shared-read guard. Many of these may exist concurrently on the same RwLock. Calling .as_ptr() yields a pointer that should be treated as &T (read-only); writing through it is a logic error the type system doesn't catch (Cryo has no borrow checker).
type struct RwLockWriteGuard<T, A> {
inner: RwLockInner<T, A>*;
}Exclusive write guard. At most one of these exists on a given RwLock, and no RwLockReadGuard can co-exist with it.
type struct RwLock<T, A = GlobalAlloc> where A: Allocator {
inner: RwLockInner<T, A>*;
}RwLock<T>: read/write reader-writer lock around a value.
std::sync::rwlocktype enum TestError {
Failed(String);
Other(String);
}Why a test failed. The runner prints the variant's message verbatim to stderr from the child process before exiting non-zero, so the parent can show the failing message in the test summary.
std::test::errortype struct RunOptions {
filter: String;
exact: boolean;
include_ignored: boolean;
list_only: boolean;
quiet: boolean;
format: TestFormat;
format_explicit: boolean;
color: ColorMode;
color_explicit: boolean;
color_active: boolean;
// … 7 more
}type struct TestRun {
outcome: TestOutcome;
captured: String;
}type struct ReporterState {
has_group: boolean;
cur_group: String;
cur_dots: String;
cur_ok: u64;
cur_fail: u64;
cur_skip: u64;
}type struct WorkerResult {
idx: u64;
kind: WorkerEventKind;
outcome: TestOutcome;
captured: String;
}One lifecycle event for a test, addressed back to its slot in the descriptor table. captured carries the child's output on a Finished event (moved across the channel; String is structurally Send); it is empty on Started and whenever capture is off.
type struct TestRunner {
opts: RunOptions;
counts: Counters;
rstate: ReporterState;
descriptors: TestDescriptor*;
count: u64;
}type struct Scope {
tids: [u64];
stack_bytes: u64;
}A thread scope. Every thread spawned through it is guaranteed to be joined before the scope is torn down (explicitly via join_all() or automatically when the Scope drops), so scoped bodies may safely borrow data that outlives the scope - pass a pointer to it through the body's context:
type struct ThreadLocal<T> {
key: u32;
}