docs

您正在閱讀 v0.1.0 的文件。Nabi 0.1.0 已停止支援。 最新版本:v0.1.3 →

core::prelude

API 參考只有英文版,由標準函式庫原始碼中的英文文件註解產生。

the names every file outside the library sees bare: user code gets an implicit use core::prelude::*; unless the file says #![no_implicit_nabi]. Each name appears once. Variants are not here: a bare variant resolves from the expected type. The OS Ext traits are here on their targets only: their methods need no use there, and elsewhere the call says where the method exists.

Re-exports

bare::ffi::types::{ c_schar, c_uchar, c_short, c_ushort, c_int, c_uint, c_long, c_ulong, c_longlong, c_ulonglong, c_size_t, c_ssize_t, c_ptrdiff_t, c_intptr_t, c_uintptr_t, c_wchar, c_float, c_double, c_void, }Source

pub use bare::ffi::types::{
    c_schar, c_uchar, c_short, c_ushort, c_int, c_uint, c_long, c_ulong, c_longlong, c_ulonglong,
    c_size_t, c_ssize_t, c_ptrdiff_t, c_intptr_t, c_uintptr_t, c_wchar, c_float, c_double, c_void,
}

core::channel::{Sender, Receiver}Source

pub use core::channel::{Sender, Receiver}

core::channel::{channel, channel_bounded}Source

pub use core::channel::{channel, channel_bounded}
  • channel An unbounded channel.
  • channel_bounded A channel holding at most cap queued values: send blocks while it is full.

core::cmp::OrderingSource

pub use core::cmp::Ordering
  • Ordering The result of a three-way comparison.

core::cmp::{Eq, Ord, Hash}Source

pub use core::cmp::{Eq, Ord, Hash}
  • Eq Total equality: == is reflexive, symmetric and transitive (no NaN).
  • Ord A total order.
  • Hash Feeds a value to a Hasher: equal values make the same writes, so a == b hashes alike - what Dict / Set rely on.

core::collections::{List, Dict, Set, Deque, BinaryHeap, Slice, SliceMut, FrozenList, FrozenDict, FrozenSet}Source

pub use core::collections::{List, Dict, Set, Deque, BinaryHeap, Slice, SliceMut, FrozenList, FrozenDict, FrozenSet}
  • List A growable array; copies share one buffer.
  • Dict S builds the hashers (RandomState: the process key).
  • Set S builds the hashers (RandomState: the process key).
  • Deque A growable ring buffer with O(1) push and pop at both ends.
  • BinaryHeap A priority queue: new() pops the greatest item first, by_ordering(cmp) the greatest by cmp.
  • Slice A zero-copy view of a buffer: element i is buf[start + i * stride].
  • SliceMut A writable view of a list's elements, like Rust's &mut [T]: s[i] = x writes the list.
  • FrozenList A list that never changes: Sync, so threads share one without a lock (a par closure may capture it, a static may hold it, a hand-off leaves it shared).
  • FrozenDict A dict that never changes: Sync, so threads share one without a lock.
  • FrozenSet A set that never changes: Sync, so threads share one without a lock.

core::convert::{From, Into, TryFrom, TryInto}Source

pub use core::convert::{From, Into, TryFrom, TryInto}
  • From A lossless conversion from U.
  • Into x.into() = T::from(x); T from the expected type.
  • TryFrom A conversion that can fail.
  • TryInto x.try_into() = T::try_from(x); throws T's Error.

core::error::ErrorSource

pub use core::error::Error
  • Error Every error type's surface.

core::error::ResultSource

pub use core::error::Result
  • Result A value or an error, kept as a value: Ok(T) or Err(E).

core::error::{ ParseError, ValueError, OverflowError, ConversionError, TypeError, StackOverflowError, OutOfMemoryError, InternalError, }Source

pub use core::error::{
    ParseError, ValueError, OverflowError, ConversionError, TypeError, StackOverflowError,
    OutOfMemoryError, InternalError,
}
  • ParseError A str that is not a valid value of the requested type (thrown by str::parse / FromStr).
  • ValueError An invalid argument value (FormatSpec::parse, hkdf::expand, ...).
  • OverflowError A value out of a fixed-width type's range in a checked conversion (thrown by try_from / try_into).
  • ConversionError A failed TryFrom conversion: the trait's default Error for impls that name no more specific one.
  • TypeError A value of the wrong type.
  • StackOverflowError Fatal: the stack ran out.
  • OutOfMemoryError Fatal: an allocation failed.
  • InternalError Fatal: a compiler bug reached at run time.

core::fmt::{Debug, Display, RichDisplay}Source

pub use core::fmt::{Debug, Display, RichDisplay}
  • Debug What f"{x:?}" writes.
  • Display What f"{x}" writes.
  • RichDisplay Renderings of a value a notebook front end shows (an image, a table, a formula): nabi jupyter sends them for a cell whose value has them, and display(x) sends them mid-cell.

core::fmt::{Formatter, FmtError}Source

pub use core::fmt::{Formatter, FmtError}
  • Formatter Where a value's text goes, with the spec it is written by: the runtime's growing text (nabi_fmt_*) and the spec packed in two words - flags: fill (bits 0..32), align, sign, type (a byte each from bit 32), # (bit 56), 0 (bit 57); counts: width, precision (32 bits each, all ones when absent).
  • FmtError A failed write.

core::future::{Future, IntoFuture}Source

pub use core::future::{Future, IntoFuture}
  • Future An asynchronous computation.
  • IntoFuture What await accepts besides a Future.

core::io::{Read, Write, AsyncRead, AsyncWrite}Source

pub use core::io::{Read, Write, AsyncRead, AsyncWrite}
  • Read A source of bytes.
  • Write A sink of bytes.
  • AsyncRead Read that suspends the task instead of blocking the thread.
  • AsyncWrite Write that suspends the task.

core::iter::{Iterator, IntoIterator, FromIterator, TryIterator}Source

pub use core::iter::{Iterator, IntoIterator, FromIterator, TryIterator}
  • Iterator A source of items, one per next call; none ends it.
  • IntoIterator A value for can walk: into_iter turns it into an iterator.
  • FromIterator A collection buildable from an iterator (collect).
  • TryIterator An iterator whose next can fail: an item, none at the end, or a thrown Error.

core::marker::{Clone, Copy, Drop, Default, Send, Sync}Source

pub use core::marker::{Clone, Copy, Drop, Default, Send, Sync}
  • Clone An explicit duplicate: x.clone(); #[derive(Clone)] clones every field.
  • Copy Bitwise copy is a correct duplicate.
  • Drop Cleanup on release.
  • Default A type's default value (0, false, '\0', "", empty collections); #[derive(Default)] defaults every field.
  • Send Safe to move to another thread.
  • Sync Safe to read through shared references from several threads.

core::num::bigfloat::FloatSource

pub use core::num::bigfloat::Float

core::num::bigint::IntSource

pub use core::num::bigint::Int
  • Int An arbitrary-precision integer.

core::ops::{PartialEq, PartialOrd}Source

pub use core::ops::{PartialEq, PartialOrd}
  • PartialEq == / !=: equality that may be partial (NaN is unequal to itself).
  • PartialOrd <, >, <=, >=: an order that may be partial (NaN).

core::panic::{panic, assert, assert_eq, assert_ne, unreachable}Source

pub use core::panic::{panic, assert, assert_eq, assert_ne, unreachable}
  • panic Abort with msg, reporting the first caller outside a #[track_caller] chain.
  • assert Abort unless cond holds.
  • assert_eq Abort unless left == right; the message shows both via Debug.
  • assert_ne Abort if left == right; the message shows both via Debug.
  • unreachable Abort: code the program believed it could never reach ran.

core::print::{print, println, eprint, eprintln, dbg, display}Source

pub use core::print::{print, println, eprint, eprintln, dbg, display}
  • print Writes v to stdout.
  • println Writes v and a newline to stdout.
  • eprint Writes v to stderr.
  • eprintln Writes v and a newline to stderr.
  • dbg Writes value's Debug form to stderr and returns value (Rust dbg!).
  • display Shows x by its RichDisplay renderings now: in a nabi jupyter notebook as the cell's output at this point (display_data), elsewhere as its text/plain line (nothing without one).

core::range::{Range, RangeInclusive}Source

pub use core::range::{Range, RangeInclusive}
  • Range a..b: from start up to but not including end.
  • RangeInclusive a..=b: from start up to and including end.

core::reflect::InspectSource

pub use core::reflect::Inspect
  • Inspect Field and method listing, opt-in through #[derive(Inspect)].

core::str::FromStrSource

pub use core::str::FromStr

core::str::StrBufSource

pub use core::str::StrBuf
  • StrBuf A growable UTF-8 buffer.

core::sync::{Mutex, RwLock, Atomic, Cell}Source

pub use core::sync::{Mutex, RwLock, Atomic, Cell}

core::task::TaskSource

pub use core::task::Task
  • Task A spawned task; await it for its result.

core::time::{Duration, Instant}Source

pub use core::time::{Duration, Instant}
  • Duration A span of time: i64 nanoseconds (about +/-292 years).
  • Instant A point on the monotonic clock; only meaningful within one process.

core::{ array, bench, channel, cmp, collections, convert, crypto, encoding, error, fmt, future, hint, index, io, iter, marker, num, ops, panic, par, print, range, reflect, str, stream, sync, task, time, tuple, }Source

pub use core::{
    array, bench, channel, cmp, collections, convert, crypto, encoding, error, fmt, future,
    hint, index, io, iter, marker, num, ops, panic, par, print, range, reflect, str, stream, sync,
    task, time, tuple,
}
  • array Clone / Copy / Default / Debug / PartialEq / Eq / Hash for fixed arrays [T; N], element-wise, and PartialOrd / Ord, lexicographic; and Array<T, N>, the n-dimensional array.
  • bench the engine nabi bench drives.
  • channel message passing between threads.
  • cmp total equality, ordering and hashing.
  • collections List / Dict / Set / Slice, Deque, BinaryHeap, SortedDict / SortedSet, and the frozen (read-only, Sync) List / Dict / Set.
  • convert conversion traits and primitive impls.
  • crypto Cryptographic algorithms: pure computation, no OS (randomness is std::random).
  • encoding bytes as text (RFC 4648): hex and base64.
  • error Result<T, E>, an error kept as a value.
  • fmt Formatter, Display / Debug, FormatSpec and the f-string lowering targets.
  • future Future / Poll / Context / Waker / IntoFuture.
  • hint hints the optimizer honors.
  • index Indexing + slicing traits.
  • io IoError, the byte-stream traits Read, BufRead, Write, Seek and their async twins, the buffers, Cursor, copy and the standard streams.
  • iter Iterator + IntoIterator + FromIterator.
  • marker Marker traits used by #[derive(..)] and other compiler-driven semantics.
  • num the primitive types' operator / comparison trait impls.
  • ops Operator traits: the source of every operator token.
  • panic the compiler hooks panic_fn / oom_fn / unreachable_fn: print a message to stderr and exit 101.
  • par data-parallel helpers, on the process's task executor (core::task): from async code on the worker it runs on, from sync code with the caller as a guest worker.
  • print print / println / eprint / eprintln, dbg and display (the prelude names them, so they need no use).
  • range Range / RangeInclusive / RangeFrom / RangeTo / RangeToInclusive / RangeFull.
  • reflect Reflect / Inspect.
  • str str methods and trait impls.
  • stream Stream / IntoStream / FromStream.
  • sync concurrency primitives.
  • task tasks on the work-stealing executor and block_on; Duration / Instant are core::time.
  • time Duration / Instant.
  • tuple Clone / Copy / Default / Debug / PartialEq / Eq / Hash for tuples of 1 to 12 elements, component-wise, and PartialOrd / Ord, lexicographic.

std::os::linux::net::TcpStreamExtSource

pub use std::os::linux::net::TcpStreamExt

std::os::linux::process::ChildExtSource

pub use std::os::linux::process::ChildExt

std::os::unix::fs::PermissionsExtSource

pub use std::os::unix::fs::PermissionsExt

std::os::unix::process::{CommandExt, ExitStatusExt}Source

pub use std::os::unix::process::{CommandExt, ExitStatusExt}