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.
DoubleCodec
DoubleListCodec
Env
A cross platform version of Platform with additional powers related to the environment
Err<S, F extends Object>
Error Result.
FlatMap<S, T>
Maps each element of the original iterator to an iterator, and then flattens the result into a single iterator.
Fs
static methods for filesystem manipulation operations.
IntCodec
IntListCodec
IoError
Represents an error that occurred during an IO operation.
IoError$IOException
All IO related exceptions.
IoError$Unknown
Represents an error that occurred during an IO operation that is not an IOException. This state may never be possible but is needed to ensure a value does not leak past the guard.
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
KeyedMutex<K>
Managed mutual exclusion based on keys.
LazyCell<T extends Object>
A value which is initialized on the first access. Non-nullable implementation of LazyCell
LazyCellAsync<T extends Object>
A value which is asynchronously initialized on the first access. Non-nullable implementation of LazyCellNullableAsync
LazyCellNullable<T>
A value which is initialized on the first access. Nullable implementation of LazyCell
LazyCellNullableAsync<T>
A value which is asynchronously initialized on the first access. Nullable implementation of LazyCellAsync
ListSizedTCodec<T>
LocalReceiver<T>
Receiver for a single isolate.
LocalSender<T>
Sender for a single isolate.
Mutex
Mutual exclusion.
Normal
A normal component, e.g., a and b in a/b
Ok<S, F extends Object>
Ok Result.
OnceCell<T extends Object>
OnceCell, A cell which can be written to only once. Non-nullable implementation of OnceCellNullable.
OnceCellNullable<T>
OnceCell, A cell which can be written to only once. Allows T to be null. Use OnceCell if T does not need to be null.
OpenOptions
Options and flags which can be used to configure how a file is opened. See OpenOptions.open.
Option<T>
Option represents the union of two types - Some<T> and None.
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 localChannel. Receivers do not close if the Sender sends an error.
RecvError
An error returned from the recv function on a LocalClosableReceiver.
RecvError$Disconnected
An error returned from the recv function on a LocalClosableReceiver when the Sender called close.
RecvError$Other
An error returned from the recv function on a LocalClosableReceiver when the Sender called sendError.
RecvError$Timeout
An error returned from the recvTimeout function on a LocalClosableReceiver when the time limit is reached before the Sender sends any data.
Result<S, F extends Object>
Result is used for propagating errors and represents the sum type of Ok and Err.
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>
A codec used to encode and decode data sent over a channel between isolates.
Sender<T>
The sending-half of localChannel.
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.
Some<T>
StringCodec
Zip<T, U>
Zips to iterators into a single iterator of pairs.

Extension Types

Arr
A fixed-size array, denoted as T; N in Rust.
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.
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

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>
Iter$IterableExtension on Iterable<T>
Iter$IterableNullable on Iterable<T?>
Iter$IterableOption on Iterable<Option<T>>
Iter$IteratorExtension on Iterator<T>
Iter$IterComparableOtherExtension on Iter<T>
Iter$IterComparableSelfExtension on Iter<T>
Iter$IterConcreteExtension on Iter<T>
Methods only implemented when T is a concrete type (non-nullable). Why: Correctness of code and reduces bugs. e.g. if nth returns null on a nullable iterable, the nth element is either null or the iterable does not have n elements. While if it returns Option, if the element is null it returns Some(null) and if it does not have n elements it returns None
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$IterNullable on Iter<T?>
Iter$IterNullableExtension on Iter<T?>
Iter$IterNullableExtensionOverride on Iter<T?>
Overrides built in extension Iter$methods on nullable Iterable.
Iter$IterOption on Iter<Option<T>>
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$NoneExtension on Option<T>
Option methods that could not be added to the main Option class.
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$RecordNullable10Extension on (A, B, C, D, E, F, G, H, I, J)
Option$RecordNullable2Extension on (A, B)
Option$RecordNullable3Extension on (A, B, C)
Option$RecordNullable4Extension on (A, B, C, D)
Option$RecordNullable5Extension on (A, B, C, D, E)
Option$RecordNullable6Extension on (A, B, C, D, E, F)
Option$RecordNullable7Extension on (A, B, C, D, E, F, G)
Option$RecordNullable8Extension on (A, B, C, D, E, F, G, H)
Option$RecordNullable9Extension on (A, B, C, D, E, F, G, H, I)
Option$RecordNullableFunction10Extension on (A Function(), B Function(), C Function(), D Function(), E Function(), F Function(), G Function(), H Function(), I Function(), J Function())
Option$RecordNullableFunction2Extension on (A Function(), B Function())
Option$RecordNullableFunction3Extension on (A Function(), B Function(), C Function())
Option$RecordNullableFunction4Extension on (A Function(), B Function(), C Function(), D Function())
Option$RecordNullableFunction5Extension on (A Function(), B Function(), C Function(), D Function(), E Function())
Option$RecordNullableFunction6Extension on (A Function(), B Function(), C Function(), D Function(), E Function(), F Function())
Option$RecordNullableFunction7Extension on (A Function(), B Function(), C Function(), D Function(), E Function(), F Function(), G Function())
Option$RecordNullableFunction8Extension on (A Function(), B Function(), C Function(), D Function(), E Function(), F Function(), G Function(), H Function())
Option$RecordNullableFunction9Extension on (A Function(), B Function(), C Function(), D Function(), E Function(), F Function(), G Function(), H Function(), I Function())
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$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$FutureNullableResultExtension on Future<Result<S, F>?>
Result$FutureResultExtension on FutureResult<S, F>
FutureResult represents an asynchronous Result. And as such, inherits all of Results methods.
Result$FutureResultNullableSExtension 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$PeekableExtension on Peekable<T>
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$ResultNullableSExtension 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$SliceConcreteExtension on Slice<T>
Methods only implemented when T is a concrete type (non-nullable). Why: Correctness of code and reduces bugs. e.g. if nth returns null on a nullable iterable, the nth element is either null or the iterable does not have n elements. While if it returns Option, if the element is null it returns Some(null) and if it does not have n elements it returns None
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>>
Vec$VecConcreteExtension on Vec<T>
Methods only implemented when T is a concrete type (non-nullable). Why: Correctness of code and reduces bugs. e.g. if nth returns null on a nullable iterable, the nth element is either null or the iterable does not have n elements. While if it returns Option, if the element is null it returns Some(null) and if it does not have n elements it returns None

Constants

None → const _None

Functions

guard<S>(S func()) Result<S, Object>
Executes the function in a protected context. func is called inside a try catch block. If the result does 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, Object>
Async version of guard
guardAsyncResult<S>(Future<Result<S, Object>> func()) FutureResult<S, Object>
Async version of guardResult
guardResult<S>(Result<S, Object> func()) Result<S, Object>
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>? toSpawnedCodec, SendCodec<U>? fromSpawnedCodec}) 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 toSpawnedCodec and/or a fromSpawnedCodec can be passed to encode and decode the messages.
localChannel<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.
panic([String? msg]) → Never
Shorthand for
panicHandler<T>(T fn(), T handler(Panic panic)) → T
Catches any Panic, Exception, or Error thrown by the function fn and handles.
panicHandlerAsync<T>(Future<T> fn(), FutureOr<T> handler(Panic panic)) Future<T>
Catches any Panic, Exception, or Error thrown by the function fn and handles.
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

FutureOption<T> = Future<Option<T>>
FutureOption represents an asynchronous Option. And as such, inherits all of Option's methods.
FutureResult<S, F extends Object> = Future<Result<S, F>>
FutureResult represents an asynchronous Result. And as such, inherits all of Results methods.
Metadata = FileStat
Metadata about a file system object - file, directory, etc.
ReadDir = List<FileSystemEntity>
A List of the entries within a directory.
Vec<T> = List<T>

Exceptions / Errors

ErrorPanic
A Panic that resulted from an Error
ExceptionPanic
A Panic that resulted from an Exception
GetManyError
GetManyError$IndexOutOfBounds
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.
Unreachable
Indicates unreachable code. This is useful any time that the compiler can’t determine that some code is unreachable. For example: