Module init

Module init 

Source
Expand description

Traits and types for initializing places.

This module defines the Init and InitPin traits, which provide abstractions for initializing uninitialized memory places. It also includes various initializers and combinators for building complex initialization patterns.

Macros§

init
Creates an initializer for a structurally initialized type.
init_pin
Creates a pin-initializer for a structurally pin-initialized type.

Structs§

And
Chains initialization with a post-initialization closure for mutable access.
AndPin
Chains initialization with a post-initialization closure for pinned mutable access.
InitError
An error that occurs during initialization of a place.
InitPinError
An error that occurs during initialization of a place.
MapErr
Maps the error type of an initializer using a closure.
Or
Provides a fallback initializer if the primary one fails.
OrElse
Provides a fallback initializer computed from the error of the primary one.
Raw
Initializes a place with a closure that has full control and cannot fail.
RawPin
Initializes a place with a closure that has full control over pinned initialization.
Repeat
Initializes all elements of a slice with a single repeated value.
RepeatWith
Initializes a slice by calling a closure for each element.
Slice
Initializes a slice by copying or cloning elements from a source slice.
SliceError
Error type for slice initialization failures.
Str
Initializes a str slice by copying from a source string slice.
TryRaw
Initializes a place with a closure that has full control.
TryRawPin
Initializes a place with a closure that has full control over the pinned place.
TryWith
Initializes a place by calling a closure that returns a Result.
UnwrapOr
Provides a fallback initializer if the primary one fails. The fallback initializer must be infallible.
UnwrapOrElse
Provides a fallback initializer computed from the error of the primary one. The fallback initializer must be infallible.
Value
Initializes a place with a directly-provided value.
With
Initializes a place by calling a closure that returns a value.

Traits§

Init
A trait for initializing a place with a value.
InitPin
A trait for initializing a place with a pinned value.
Initializer
A marker trait for initializers.
IntoInit
A trait for converting a value into an initializer for type T.
IntoInitPin
A trait for converting a value into a pin-initializer for type T.
StructuralInit
Types that can be structurally initialized in a place.
StructuralInitPin
Types that can be structurally initialized in a pinned place.

Functions§

adapt_err
Adapts an infallible initializer to one that can fail with any error type.
and
Chains initialization with a post-initialization closure for mutable access.
and_pin
Chains initialization with a post-initialization closure for pinned mutable access.
map_err
Maps the error type of an initializer using a closure.
or
Provides a fallback initializer if the primary one fails.
or_else
Provides a fallback initializer computed from the error of the primary one.
raw
Creates a raw initializer from a closure.
raw_pin
Creates a raw pinned initializer from a closure.
repeat
Initializes all elements of a slice with a single repeated value.
repeat_with
Initializes a slice by calling a closure for each element.
slice
Initializes a slice by copying or cloning elements from a source slice.
str
Initializes a str slice by copying from a source string slice.
try_raw
Creates a raw initializer from a closure.
try_raw_pin
Creates a raw initializer from a closure.
try_with
Initializes a place by calling a closure that returns a Result.
unwrap_or
Provides a fallback initializer if the primary one fails. The fallback initializer must be infallible.
unwrap_or_else
Provides a fallback initializer computed from the error of the primary one. The fallback initializer must be infallible.
value
Creates an initializer for a directly-provided value.
with
Creates an initializer from a closure that produces a value.

Type Aliases§

InitPinResult
The result type for pinned initialization.
InitResult
The result type for initialization.

Derive Macros§

Init
Marks a type as structurally initializable.
InitPin
Marks a type as structurally pin-initializable.