docs

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

core

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

core tier (foundation) - safe, target-independent. Owns: List, Dict, Set, Tuple, Int, Float, ops, iter, sync (Atomic/Mutex), task, time (Duration, Instant), par, fmt, reflect, future, crypto (algorithms), encoding, io (byte streams, stdio). Bootstraps operator dispatch (#[infix], #[prefix], #[postfix]) and literal handlers (#[literal]). User code gets an implicit use core::prelude::*;, the library's own modules see all of core::**.

Modules

  • 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.
  • hash what a Hash impl writes to: Hasher, BuildHasher, the process-keyed RandomState that Dict and Set default to with its SipHash-1-3 DefaultHasher, and the caller-keyed SipHasher13 / SipHasher24, whose output is stable.
  • 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.
  • prelude the names every file outside the library sees bare: user code gets an implicit use core::prelude::*; unless the file says #![no_implicit_nabi].
  • 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.
  • simd portable SIMD: Simd<T, N> holds N lanes of a number T, and its operators work on every lane at once.
  • 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.