Expand description
The gstd default prelude. Re-imports default std modules and traits.
std can be safely replaced to gstd in the Rust programs.
Re-exports§
pub use crate::ReservationIdExt;pub use parity_scale_codec as codec;pub use scale_info;
Modules§
- any
- Utilities for dynamic typing or type reflection.
- array
- Utilities for the array primitive type.
- ascii
- Operations on ASCII strings and characters.
- borrow
- A module for working with borrowed data.
- boxed
- The
Box<T>type for heap allocation. - cell
- Shareable mutable containers.
- char
- Utilities for the
charprimitive type. - clone
- The
Clonetrait for types that cannot be ‘implicitly copied’. - cmp
- Utilities for comparing and ordering values.
- collections
- Collection types.
- convert
- Traits for conversions between types.
- default
- The
Defaulttrait for types with a default value. - ffi
- Utilities related to FFI bindings.
- fmt
- Utilities for formatting and printing
Strings. - future
- Asynchronous basic functionality.
- hash
- Generic hashing support.
- hint
- Hints to compiler that affects how code should be emitted or optimized.
- iter
- Composable external iteration.
- marker
- Primitive traits and types representing basic properties of types.
- mem
- Basic functions for dealing with memory.
- num
- Numeric traits and functions for the built-in numeric types.
- ops
- Overloadable operators.
- option
- Optional values.
- panic
- Panic support in the standard library.
- pin
- Types that pin data to a location in memory.
- primitive
- This module reexports the primitive types to allow usage that is not possibly shadowed by other declared types.
- ptr
- Manually manage memory through raw pointers.
- rc
- Single-threaded reference-counting pointers. ‘Rc’ stands for ‘Reference Counted’.
- result
- Error handling with the
Resulttype. - slice
- Slice management and manipulation.
- str
- Utilities for the
strprimitive type. - string
- A UTF-8–encoded, growable string.
- task
- Types and Traits for working with asynchronous tasks.
- time
- Temporal quantification.
- vec
- A contiguous growable array type with heap-allocated contents, written
Vec<T>.
Macros§
- assert
- Asserts that a boolean expression is
trueat runtime. - assert_
eq - Asserts that two expressions are equal to each other (using
PartialEq). - assert_
ne - Asserts that two expressions are not equal to each other (using
PartialEq). - cfg
- Evaluates boolean combinations of configuration flags at compile-time.
- column
- Expands to the column number at which it was invoked.
- compile_
error - Causes compilation to fail with the given error message when encountered.
- concat
- Concatenates literals into a static string slice.
- dbg
- Prints and returns the value of a given expression for quick and dirty debugging.
- debug_
assert - Asserts that a boolean expression is
trueat runtime. - debug_
assert_ eq - Asserts that two expressions are equal to each other.
- debug_
assert_ ne - Asserts that two expressions are not equal to each other.
- env
- Inspects an environment variable at compile time.
- file
- Expands to the file name in which it was invoked.
- format
- Creates a
Stringusing interpolation of runtime expressions. - format_
args - Constructs parameters for the other string-formatting macros.
- include
- Parses a file as an expression or an item according to the context.
- include_
bytes - Includes a file as a reference to a byte array.
- include_
str - Includes a UTF-8 encoded file as a string.
- line
- Expands to the line number on which it was invoked.
- matches
- Returns whether the given expression matches the provided pattern.
- module_
path - Expands to a string that represents the current module path.
- option_
env - Optionally inspects an environment variable at compile time.
- panic
- Panics the current thread.
- static_
mut - Get mutable reference to
static mut. - static_
ref - Get shared reference to
static mut. - stringify
- Stringifies its arguments.
- todo
- Indicates unfinished code.
- unimplemented
- Indicates unimplemented code by panicking with a message of “not implemented”.
- unreachable
- Indicates unreachable code.
- vec
- Creates a
Veccontaining the arguments. - write
- Writes formatted data into a buffer.
- writeln
- Writes formatted data into a buffer, with a newline appended.
- concat_
bytes Experimental - Concatenates literals into a byte slice.
- concat_
idents Experimental - Concatenates identifiers into one identifier.
- deref
Experimental - Unstable placeholder for deref patterns.
- format_
args_ nl Experimental - Same as
format_args, but adds a newline in the end. - log_
syntax Experimental - Prints passed tokens into the standard output.
- trace_
macros Experimental - Enables or disables tracing functionality used for debugging other macros.
- type_
ascribe Experimental - Unstable placeholder for type ascription.
Structs§
- Box
- A pointer type that uniquely owns a heap allocation of type
T. - String
- A UTF-8–encoded, growable string.
- Vec
- A contiguous growable array type, written as
Vec<T>, short for ‘vector’.
Enums§
- Option
- The
Optiontype. See the module level documentation for more. - Result
Resultis a type that represents either success (Ok) or failure (Err).
Traits§
- AsMut
- Used to do a cheap mutable-to-mutable reference conversion.
- AsRef
- Used to do a cheap reference-to-reference conversion.
- AsyncFn
- An async-aware version of the
Fntrait. - Async
FnMut - An async-aware version of the
FnMuttrait. - Async
FnOnce - An async-aware version of the
FnOncetrait. - Clone
- A common trait for the ability to explicitly duplicate an object.
- Copy
- Types whose values can be duplicated simply by copying bits.
- Decode
- Trait that allows zero-copy read of value-references from slices in LE format.
- Default
- A trait for giving a type a useful default value.
- Double
Ended Iterator - An iterator able to yield elements from both ends.
- Drop
- Custom code within the destructor.
- Encode
- Trait that allows zero-copy write of value-references to slices in LE format.
- Encode
Like - A marker trait that tells the compiler that a type encode to the same representation as another type.
- Eq
- Trait for comparisons corresponding to equivalence relations.
- Exact
Size Iterator - An iterator that knows its exact length.
- Extend
- Extend a collection with the contents of an iterator.
- Fn
- The version of the call operator that takes an immutable receiver.
- FnMut
- The version of the call operator that takes a mutable receiver.
- FnOnce
- The version of the call operator that takes a by-value receiver.
- From
- Used to do value-to-value conversions while consuming the input value. It is the reciprocal of
Into. - From
Iterator - Conversion from an
Iterator. - Into
- A value-to-value conversion that consumes the input value. The
opposite of
From. - Into
Iterator - Conversion into an
Iterator. - Iterator
- A trait for dealing with iterators.
- MaxEncoded
Len - Items implementing
MaxEncodedLenhave a statically known maximum encoded size. - Ord
- Trait for types that form a total order.
- Partial
Eq - Trait for comparisons using the equality operator.
- Partial
Ord - Trait for types that form a partial order.
- Send
- Types that can be transferred across thread boundaries.
- Sized
- Types with a constant size known at compile time.
- Sync
- Types for which it is safe to share references between threads.
- ToOwned
- A generalization of
Cloneto borrowed data. - ToString
- A trait for converting a value to a
String. - TryFrom
- Simple and safe type conversions that may fail in a controlled
way under some circumstances. It is the reciprocal of
TryInto. - TryInto
- An attempted conversion that consumes
self, which may or may not be expensive. - Type
Info - Implementors return their meta type information.
- Unpin
- Types that do not require any pinning guarantees.
Functions§
- align_
of - Returns the ABI-required minimum alignment of a type in bytes.
- align_
of_ val - Returns the ABI-required minimum alignment of the type of the value that
valpoints to in bytes. - drop
- Disposes of a value.
- size_of
- Returns the size of a type in bytes.
- size_
of_ val - Returns the size of the pointed-to value in bytes.
Attribute Macros§
- derive
- Attribute macro used to apply derive macros.
- global_
allocator - Attribute macro applied to a static to register it as a global allocator.
- test
- Attribute macro applied to a function to turn it into a unit test.
- alloc_
error_ handler Experimental - Attribute macro applied to a function to register it as a handler for allocation failure.
- bench
Experimental - Attribute macro applied to a function to turn it into a benchmark test.
- cfg_
accessible Experimental - Keeps the item it’s applied to if the passed path is accessible, and removes it otherwise.
- cfg_
eval Experimental - Expands all
#[cfg]and#[cfg_attr]attributes in the code fragment it’s applied to. - define_
opaque Experimental - Provide a list of type aliases and other opaque-type-containing type definitions. This list will be used in the body of the item it is applied to define opaque types’ hidden types. Can only be applied to things that have bodies.
- derive_
const Experimental - Attribute macro used to apply derive macros for implementing traits in a const context.
- test_
case Experimental - An implementation detail of the
#[test]and#[bench]macros.
Derive Macros§
- Clone
- Derive macro generating an impl of the trait
Clone. - Copy
- Derive macro generating an impl of the trait
Copy. - Debug
- Derive macro generating an impl of the trait
Debug. - Decode
- Derive
parity_scale_codec::Decodefor struct and enum. - Default
- Derive macro generating an impl of the trait
Default. - Encode
- Derive
parity_scale_codec::Encodeandparity_scale_codec::EncodeLikefor struct and enum. - Eq
- Derive macro generating an impl of the trait
Eq. - Hash
- Derive macro generating an impl of the trait
Hash. - MaxEncoded
Len - Derive
parity_scale_codec::MaxEncodedLenfor struct and enum. - Ord
- Derive macro generating an impl of the trait
Ord. The behavior of this macro is described in detail here. - Partial
Eq - Derive macro generating an impl of the trait
PartialEq. The behavior of this macro is described in detail here. - Partial
Ord - Derive macro generating an impl of the trait
PartialOrd. The behavior of this macro is described in detail here. - Type
Info