rust library

Classes

ArrayChunks<T>
Returns an iterator over N elements of the iterator at a time. The chunks do not overlap. If N does not divide the length of the iterator, then the last up to N-1 elements will be omitted and can be retrieved from the .intoRemainder() function of the iterator.
BooleanCodec
BooleanListCodec
Cast<S, T>
Cell<T>
A wrapper with interior mutability. Useful for primitives and an escape hatch for working with immutable data patterns.
Chain<T>
Takes two iterators and creates a new iterator over both in sequence.
Clone<T>
An iterator which is a "clone" of the original iterator. Iterating through the original or the clone will not affect the other. Note: Do not modify the original collection the original Iterable is based on while iterating. Explanation: Since Dart Iterators cannot be copied, Clone replaces the underlying iterator from the Iter provided in the constructor with itself and collects any first calls to moveNext from any derived iterator. Due to this, modifications of the original iterable may have unintentional behavior on the cloned iterator. i.e. the first encounter of an object during iteration will be the one seen by the derived Iter and all other subsequent Clones. Therefore if creating a Clone do not modify the original collection the passed in Iter is based on.
Component
A component of a path. A Component roughly corresponds to a substring between path separators (/ or ). e.g. .., dir_name, file_name.txt
ConstCell<T>
A constant container.
CurDir
The current directory of a path. i.e. .
Cycle<T>
Creates an iterator which repeats the elements of the original iterator endlessly.
DisconnectedError
An error returned from the recv function on a LocalClosableReceiver when the Sender called close.
DoubleCodec
DoubleListCodec
FlatMap<S, T>
Maps each element of the original iterator to an iterator, and then flattens the result into a single iterator.
IntCodec
IntListCodec
IsolateReceiver<T>
IsolateSender<T>
Iter<T>
Iter is the union between an Iterator and an Iterable. Most iterator methods are consuming and should be assumed to be so unless otherwise stated.
IterableRangeBounds
LazyCell<T extends Object>
A value which is initialized on the first access.
LazyCellAsync<T extends Object>
A value which is asynchronously initialized on the first access.
ListSizedTCodec<T>
LocalReceiver<T>
Receiver for a single isolate.
LocalSender<T>
Sender for a single isolate.
Mutex
Mutual exclusion.
NonNullableLazyCell<T extends Object>
A value which is initialized on the first access. Non-nullable implementation of LazyCell
NonNullableLazyCellAsync<T extends Object>
A value which is asynchronously initialized on the first access. Non-nullable implementation of LazyCellAsync
NonNullableOnceCell<T extends Object>
OnceCell, A cell which can be written to only once. OnceCell implementation based off Option
Normal
A normal component, e.g., a and b in a/b
NullableLazyCell<T>
A value which is initialized on the first access. Nullable implementation of LazyCell
NullableLazyCellAsync<T>
A value which is asynchronously initialized on the first access. Nullable implementation of LazyCellAsync
NullableOnceCell<T>
OnceCell, A cell which can be written to only once. OnceCell implementation that allows T to be null and does not use Option
OnceCell<T extends Object>
OnceCell, A cell which can be written to only once.
OtherError
An error returned from the recv function on a LocalClosableReceiver when the Sender called sendError.
ParentDir
The parent directory of a path. i.e. ..
Peekable<T>
An iterator which can use the "peek" to look at the next element of the iterator without consuming it.
Prefix
A Windows path prefix, e.g., C: or \server\share. Does not occur on Unix.
Range
A (half-open) range bounded inclusively below and exclusively above (start..end). The range contains all values with start <= x < end. It is empty if start >= end.
RangeBounds
RangeFrom
A range only bounded inclusively below (start..). Contains all values with x >= start. Note: This will not overflow, the last value yielded will be the largest possible int _intMaxValue.
RangeFull
An unbounded range (..). RangeFull is used as a slicing index, it cannot be used as an Iterable because it doesn’t have a starting point.
RangeInclusive
A range bounded inclusively below and above (start..=end). Contains all values with x >= start and x <= end. It is empty unless start <= end.
RangeIterator
RangeTo
A range only bounded exclusively above (..end). The RangeTo ..end contains all values with x < end. It cannot be used as an Iterable because it doesn’t have a starting point.
RangeToInclusive
A range only bounded inclusively above (..=end). The RangeToInclusive ..=end contains all values with x <= end. It cannot serve as an Iterable because it doesn’t have a starting point.
Receiver<T>
The receiving-half of channel. Receivers do not close if the Sender sends an error.
RecvError
An error returned from the recv function on a LocalClosableReceiver.
RecvTimeoutError
An error returned from the recvTimeout function on a LocalClosableReceiver.
RootDir
The root directory component, appears after any prefix and before anything else. It represents a separator that designates that a path starts from root.
RwLock
Mutual exclusion that supports read and write locks.
SendCodec<T>
The codec use to encode and decode data send over over a channel between isolates.
Sender<T>
The sending-half of channel.
SendError
A SendError can only happen if the channel is disconnected, implying that the data could never be received.
Slice<T>
A contiguous sequence of elements in a List. Slices are a view into a list without allocating and copying to a new list, as such, they do not own their own data. Note: Shrinking the original list can cause the slices range to become invalid, which may cause an exception or unintended behavior.
SliceIterator<T>
An iterator over the elements of a Slice.
StringCodec
TimeoutError
An error returned from the recvTimeout function on a LocalClosableReceiver when the time limit is reached before the Sender sends any data.
Zip<T, U>
Zips to iterators into a single iterator of pairs.

Enums

ErrorDisplayOrder
Controls the base toString format
StackTraceDisplayFormat
How StackTrace should be displayed to the user.

Extension Types

Arr
A fixed-size array, denoted as T; N in Rust.
Option
Option represents the union of two types - Some<T> and None. As an extension Option$type of T?, Option<T> has the same runtime cost of T? with the advantage of being able to chain null specific operations.
Path
A platform dependent Path type. Thus, will use windows paths on windows and unix paths on all other platforms. Path is for handling file paths in a type-safe manner. This type supports a number of operations for inspecting a path, including breaking the path into its components, extracting the file name, determining whether the path is absolute, and so on.
Some
Represents a value that is present. The erasure of this is T.
UnixPath
A Unix Path. Path is for handling file paths in a type-safe manner. This type supports a number of operations for inspecting a path, including breaking the path into its components, extracting the file name, determining whether the path is absolute, and so on.
WindowsPath
A Windows Path. Path is for handling file paths in a type-safe manner. This type supports a number of operations for inspecting a path, including breaking the path into its components, extracting the file name, determining whether the path is absolute, and so on.

Extensions

AnyhowErrExtension on Err<S>
AnyhowFutureIterableResultExtension on Future<Iterable<Result<S>>>
AnyhowFutureResultExtension on FutureResult<S>
AnyhowIterableResultExtension on Iterable<Result<S>>
AnyhowOkExtension on Ok<S>
AnyhowResultExtension on Result<S>
Array$IterableExtension on Iterable<T>
Array$ListExtension on List<T>
Cell$CellBoolExtension on Cell<bool>
Cell$CellDoubleExtension on Cell<double>
Cell$CellIntExtension on Cell<int>
Cell$CellStringExtension on Cell<String>
Cell$ConstCellBoolExtension on ConstCell<bool>
Cell$ConstCellDoubleExtension on ConstCell<double>
Cell$ConstCellIntExtension on ConstCell<int>
Cell$ConstCellStringExtension on ConstCell<String>
FutureAnyhowError on Future<Error>
Iter$IterableExtension on Iterable<T>
Iter$IteratorExtension on Iterator<T>
Iter$IterComparableOtherExtension on Iter<T>
Iter$IterComparableSelfExtension on Iter<T>
Iter$IterExtension on Iter<T>
Iter$IterExtensionOverride on Iter<T>
Overrides built in extension Iter$methods on Iterable.
Iter$IterIterableExtension on Iter<Iterable<T>>
Iter$IterNullableExtensionOverride on Iter<T?>
Overrides built in extension Iter$methods on nullable Iterable.
Iter$IterOptionExtension on Iter<Option<T>>
Iter$IterRecord2Extension on Iter<(T, U)>
Iter$IterResultExtension on Iter<Result<T, E>>
OpsListExtension on List<T>
OpsRecordExtension1 on (A)
OpsRecordExtension10 on (A, B, C, D, E, F, G, H, I, J)
OpsRecordExtension2 on (A, B)
OpsRecordExtension3 on (A, B, C)
OpsRecordExtension4 on (A, B, C, D)
OpsRecordExtension5 on (A, B, C, D, E)
OpsRecordExtension6 on (A, B, C, D, E, F)
OpsRecordExtension7 on (A, B, C, D, E, F, G)
OpsRecordExtension8 on (A, B, C, D, E, F, G, H)
OpsRecordExtension9 on (A, B, C, D, E, F, G, H, I)
Option$FutureNullableExtension on Future<T?>
Option$FutureOptionExtension on FutureOption<T>
FutureOption represents an asynchronous Option. And as such, inherits all of Option's methods.
Option$FutureOptionOptionExtension on FutureOption<Option<T>>
Option$FutureOptionRecord2Extension on FutureOption<(T, U)>
Option$FutureOptionResultExtension on FutureOption<Result<S?, F>>
Option$NoneMethodsExtension on _None
Option$OptionMethodsExtension on Option<T>
Option$OptionNestedRecord3Extension on Option<((A, B), C)>
Option$OptionNestedRecord4Extension on Option<(((A, B), C), D)>
Option$OptionNestedRecord5Extension on Option<((((A, B), C), D), E)>
Option$OptionNullableExtension on Option<T?>
Option$OptionOptionExtension on Option<Option<T>>
Option$OptionRecord2Extension on Option<(T, U)>
Option$OptionResultExtension on Option<Result<S?, F>>
Option$RecordOption10Extension on (Option<A>, Option<B>, Option<C>, Option<D>, Option<E>, Option<F>, Option<G>, Option<H>, Option<I>, Option<J>)
Option$RecordOption2Extension on (Option<A>, Option<B>)
Option$RecordOption3Extension on (Option<A>, Option<B>, Option<C>)
Option$RecordOption4Extension on (Option<A>, Option<B>, Option<C>, Option<D>)
Option$RecordOption5Extension on (Option<A>, Option<B>, Option<C>, Option<D>, Option<E>)
Option$RecordOption6Extension on (Option<A>, Option<B>, Option<C>, Option<D>, Option<E>, Option<F>)
Option$RecordOption7Extension on (Option<A>, Option<B>, Option<C>, Option<D>, Option<E>, Option<F>, Option<G>)
Option$RecordOption8Extension on (Option<A>, Option<B>, Option<C>, Option<D>, Option<E>, Option<F>, Option<G>, Option<H>)
Option$RecordOption9Extension on (Option<A>, Option<B>, Option<C>, Option<D>, Option<E>, Option<F>, Option<G>, Option<H>, Option<I>)
Option$RecordOptionFunction10Extension on (Option<A> Function(), Option<B> Function(), Option<C> Function(), Option<D> Function(), Option<E> Function(), Option<F> Function(), Option<G> Function(), Option<H> Function(), Option<I> Function(), Option<J> Function())
Option$RecordOptionFunction2Extension on (Option<A> Function(), Option<B> Function())
Option$RecordOptionFunction3Extension on (Option<A> Function(), Option<B> Function(), Option<C> Function())
Option$RecordOptionFunction4Extension on (Option<A> Function(), Option<B> Function(), Option<C> Function(), Option<D> Function())
Option$RecordOptionFunction5Extension on (Option<A> Function(), Option<B> Function(), Option<C> Function(), Option<D> Function(), Option<E> Function())
Option$RecordOptionFunction6Extension on (Option<A> Function(), Option<B> Function(), Option<C> Function(), Option<D> Function(), Option<E> Function(), Option<F> Function())
Option$RecordOptionFunction7Extension on (Option<A> Function(), Option<B> Function(), Option<C> Function(), Option<D> Function(), Option<E> Function(), Option<F> Function(), Option<G> Function())
Option$RecordOptionFunction8Extension on (Option<A> Function(), Option<B> Function(), Option<C> Function(), Option<D> Function(), Option<E> Function(), Option<F> Function(), Option<G> Function(), Option<H> Function())
Option$RecordOptionFunction9Extension on (Option<A> Function(), Option<B> Function(), Option<C> Function(), Option<D> Function(), Option<E> Function(), Option<F> Function(), Option<G> Function(), Option<H> Function(), Option<I> Function())
Option$SomeMethodsExtension on Some<T>
Option$ToFutureOptionExtension on Option<T>
Path$StringExtension on String
Result$FutureIterableFutureResultExtension on Future<Iterable<FutureResult<S, F>>>
Result$FutureIterableResultExtension on Future<Iterable<Result<S, F>>>
Result$FutureResultExtension on FutureResult<S, F>
FutureResult represents an asynchronous Result. And as such, inherits all of Results methods.
Result$FutureResultNullableExtension on Future<Result<S?, F>>
Result$FutureResultOptionExtension on Future<Result<Option<S?>, F>>
Result$FutureResultResultExtension on FutureResult<Result<S, F>, F>
Result$InfallibleErrExtension on Result<Never, F>
Result$InfallibleFutureErrExtension on FutureResult<Never, F>
Result$InfallibleFutureOkExtension on FutureResult<S, Never>
Result$InfallibleOkExtension on Result<S, Never>
Result$IterableFutureResultExtension on Iterable<FutureResult<S, F>>
Result$IterableResultExtension on Iterable<Result<S, F>>
Result$NullableResultExtension on Result<S, F>?
Result$RecordFunctionResult10Extension on (Result<A, Z> Function(), Result<B, Z> Function(), Result<C, Z> Function(), Result<D, Z> Function(), Result<E, Z> Function(), Result<F, Z> Function(), Result<G, Z> Function(), Result<H, Z> Function(), Result<I, Z> Function(), Result<J, Z> Function())
Result$RecordFunctionResult2Extension on (Result<A, Z> Function(), Result<B, Z> Function())
Result$RecordFunctionResult3Extension on (Result<A, Z> Function(), Result<B, Z> Function(), Result<C, Z> Function())
Result$RecordFunctionResult4Extension on (Result<A, Z> Function(), Result<B, Z> Function(), Result<C, Z> Function(), Result<D, Z> Function())
Result$RecordFunctionResult5Extension on (Result<A, Z> Function(), Result<B, Z> Function(), Result<C, Z> Function(), Result<D, Z> Function(), Result<E, Z> Function())
Result$RecordFunctionResult6Extension on (Result<A, Z> Function(), Result<B, Z> Function(), Result<C, Z> Function(), Result<D, Z> Function(), Result<E, Z> Function(), Result<F, Z> Function())
Result$RecordFunctionResult7Extension on (Result<A, Z> Function(), Result<B, Z> Function(), Result<C, Z> Function(), Result<D, Z> Function(), Result<E, Z> Function(), Result<F, Z> Function(), Result<G, Z> Function())
Result$RecordFunctionResult8Extension on (Result<A, Z> Function(), Result<B, Z> Function(), Result<C, Z> Function(), Result<D, Z> Function(), Result<E, Z> Function(), Result<F, Z> Function(), Result<G, Z> Function(), Result<H, Z> Function())
Result$RecordFunctionResult9Extension on (Result<A, Z> Function(), Result<B, Z> Function(), Result<C, Z> Function(), Result<D, Z> Function(), Result<E, Z> Function(), Result<F, Z> Function(), Result<G, Z> Function(), Result<H, Z> Function(), Result<I, Z> Function())
Result$RecordResult10Extension on (Result<A, Z>, Result<B, Z>, Result<C, Z>, Result<D, Z>, Result<E, Z>, Result<F, Z>, Result<G, Z>, Result<H, Z>, Result<I, Z>, Result<J, Z>)
Result$RecordResult2Extension on (Result<A, Z>, Result<B, Z>)
Result$RecordResult3Extension on (Result<A, Z>, Result<B, Z>, Result<C, Z>)
Result$RecordResult4Extension on (Result<A, Z>, Result<B, Z>, Result<C, Z>, Result<D, Z>)
Result$RecordResult5Extension on (Result<A, Z>, Result<B, Z>, Result<C, Z>, Result<D, Z>, Result<E, Z>)
Result$RecordResult6Extension on (Result<A, Z>, Result<B, Z>, Result<C, Z>, Result<D, Z>, Result<E, Z>, Result<F, Z>)
Result$RecordResult7Extension on (Result<A, Z>, Result<B, Z>, Result<C, Z>, Result<D, Z>, Result<E, Z>, Result<F, Z>, Result<G, Z>)
Result$RecordResult8Extension on (Result<A, Z>, Result<B, Z>, Result<C, Z>, Result<D, Z>, Result<E, Z>, Result<F, Z>, Result<G, Z>, Result<H, Z>)
Result$RecordResult9Extension on (Result<A, Z>, Result<B, Z>, Result<C, Z>, Result<D, Z>, Result<E, Z>, Result<F, Z>, Result<G, Z>, Result<H, Z>, Result<I, Z>)
Result$ResultFutureToFutureResultExtension on Result<Future<S>, F>
Result$ResultNullableExtension on Result<S?, F>
Result$ResultOptionExtension on Result<Option<S?>, F>
Result$ResultResultExtension on Result<Result<S, F>, F>
Result$ResultToFutureResultExtension on Result<S, F>
Result$ToErrExtension on E
Result$ToOkExtension on S
Slice$ListExtension on List<T>
Slice$SliceComparableSelfExtension on Slice<T>
Slice$SliceNumExtension on Slice<T>
Str$StringExtension on String
Vec$ArrExtension on Arr<T>
Vec$IterableExtension on Iterable<T>
Vec$IteratorExtension on Iterator<T>
Vec$ListExtension on List<T>
A contiguous growable array type, written as Vec
Vec$ListListExtension on List<List<T>>

Constants

None → const _None
Represents a value that is absent. The erasure of this is null.

Functions

anyhow<S>(Object err, [StackTrace? stackTrace]) Error
Convenience function for turning an object into an Error. stackTrace will be ignored if Error.hasStackTrace is false.
bail<S>(Object err, [StackTrace? stackTrace]) Err<S>
Convenience function for turning an object into an anyhow Err Result. stackTrace will be ignored if Error.hasStackTrace is false.
channel<T>() → (LocalSender<T>, LocalReceiver<T>)
Creates a new channel, returning the Sender and LocalClosableReceiver. Each item T sent by the Sender will only be seen once by the LocalClosableReceiver. Even if the Sender calls close while the LocalClosableReceivers buffer is not empty, the LocalClosableReceiver will still yield the remaining items in the buffer until empty.
ensure(bool fn(), Object err, [StackTrace? stackTrace]) Result<()>
Convenience function for creating a Result to return with the err if the condition does not hold.
guard<S>(S func()) Result<S>
Executes the function in a protected context. func is called inside a try catch block. If the result is not catch, then return value func returned inside an Ok. If func throws, then the thrown value is returned inside an Err.
guardAsync<S>(Future<S> func()) FutureResult<S>
Async version of guard
guardAsyncResult<S>(Future<Result<S>> func()) FutureResult<S>
Async version of guardResult
guardResult<S>(Result<S> func()) Result<S>
Result unwrapping version of guard. Where func returns an Result, but can still throw.
identity<T>(T x) → T
The identity function. While it might seem strange to have a function that just returns back the input, there are some interesting uses.
isolateChannel<T, U>(FutureOr<void> func(IsolateSender<U> tx, IsolateReceiver<T> rx), {SendCodec<T>? toIsolateCodec, SendCodec<U>? fromIsolateCodec}) Future<(IsolateSender<T>, IsolateReceiver<U>)>
isolateChannel is used for bi-directional isolate communication. The returned Sender and Receiver can communicate with the spawned isolate and the spawned isolate is passed a Sender and Receiver to communicate with the original isolate. Each item T sent by a Sender will only be seen once by the corresponding Receiver. If the Sender calls close while the Receiver's buffer is not empty, the Receiver will still yield the remaining items in the buffer until empty. Types that can be sent over a SendPort, as defined here https://api.flutter.dev/flutter/dart-isolate/SendPort/send.html , are allow to be sent between isolates. Otherwise a toIsolateCodec and/or a fromIsolateCodec can be passed to encode and decode the messages.
panic([String? msg]) → Never
Shorthand for
range(int startOrEnd, [int? end, int? step]) Iterable<int>
A generator over a range by a step size. If end is not provided, the generated range will be [0..startOrEnd) if startOrEnd > 0, and nothing is generated otherwise. If step is not provided, step will be -1 if 0 > startOrEnd and 1 if 0 < startOrEnd. For reference, it works the same as the python range function.
unreachable([String msg = "This code should be unreachable."]) → Never
Shorthand for

Typedefs

Err<S> = Err<S, Error>
Error Result.
FutureOption<T> = Future<Option<T>>
FutureOption represents an asynchronous Option. And as such, inherits all of Option's methods.
FutureResult<S> = Future<Result<S>>
FutureResult represents an asynchronous Result. And as such, inherits all of Results methods.
Infallible = Never
The error type for errors that can never happen
Ok<S> = Ok<S, Error>
Ok Result.
Result<S> = Result<S, Error>
Result is used for propagating errors and represents the sum type of Ok and Err.
Vec<T> = List<T>

Exceptions / Errors

Error
Error is a wrapper around an Object that represents an error or context around a parent error. Used for chaining error Objects that are related.
GetManyError
GetManyErrorRequestedIndexOutOfBounds
Panic
As with Error, Panic represents a state that should never happen and thus is not expected to be catch. This is closely tied to the unwrap method of both Option and Result types.
PathIoError
PathIoError$NotADirectory
PathIoError$NotAFile
PathIoError$NotAValidPath
PathIoError$Unknown
Unreachable
Indicates unreachable code. This is useful any time that the compiler can’t determine that some code is unreachable. For example: