Crate mm0_util

Source
Expand description

Utilities, mainly path manipulation with some newtype definitions.

The types Position and Range will be different depending on whether the server feature is enabled.

Macros§

const_panic
Does the same as panic! but works in a const fn.
let_unchecked
let_unchecked!(x as p = e) is the same as
unwrap_unchecked
Like unwrap, but invokes undefined behavior instead of panicking.

Structs§

ArcList
A linked list data structure based on Arc.
ArcListIter
An iterator over an ArcList.
ArcString
Newtype for an Arc<String>, so that we can implement From<&str>.
AtomId
An index into a AtomVec
AtomVec
A vector wrapper with a strongly typed index interface.
CURRENT_DIR
A PathBuf created by lazy_static! pointing to a canonicalized “.”
FileRef
A reference to a file. It wraps an Arc so it can be cloned thread-safely. A FileRef can be constructed either from a PathBuf or a (file://) Url, and provides (precomputed) access to these views using path() and url(), as well as rel() to get the relative path from CURRENT_DIR.
FileSpan
A span paired with a FileRef.
LinedString
Wrapper around std’s String which stores data about the positions of any newline characters.
Modifiers
Visibility and sort modifiers for Sort statements and Declarations.
Position
Position in a text document expressed as zero-based line and character offset. A position is between two characters like an ‘insert’ cursor in a editor.
Range
A range in a text document expressed as (zero-based) start and end positions. A range is comparable to a selection in an editor. Therefore the end position is exclusive.
SliceUninit
A way to initialize a Box<[T]> by first constructing the array (giving the length), initializing the elements in some order, and then using the unsafe function assume_init to assert that every element of the array has been initialized and transmute the SliceUninit<T> into a Box<[T]>.
SortId
An index into a SortVec
SortVec
A vector wrapper with a strongly typed index interface.
Span
Points to a specific region of a source file by identifying the region’s start and end points.
StackList
A structure that allows constructing linked lists on the call stack.
TermId
An index into a TermVec
TermVec
A vector wrapper with a strongly typed index interface.
ThmId
An index into a ThmVec
ThmVec
A vector wrapper with a strongly typed index interface.

Enums§

Prec
A precedence literal, such as 123 or max. These are used in notations like notation add = ($+$:23) or infix add: $+$ prec 23;.

Constants§

APP_PREC
The precedence of application, 1024. This determines whether f x + y is interpreted as f (x + y) or (f x) + y, by comparing the precedence of + to APP_PREC.

Traits§

CondvarExt
Extension trait for Condvar.
HashMapExt
Extension trait for HashMap<K, V>.
MutexExt
Extension trait for Mutex<T>.
RcExt
Extension trait for HashMap<K, V>.
SliceExt
Extension trait for cloned_box.

Functions§

alphanumber
Translate a number into an alphabetic numbering system, indexing into the following infinite sequence:
get_memory_usage
Try to get total memory usage (stack + data) in bytes using the /proc filesystem. Falls back on getrusage() if procfs doesn’t exist.
u32_as_usize
Converts n from u32 to usize or panics (which should not happen since we don’t support 16 bit systems).

Type Aliases§

BoxError
Newtype for Box<dyn Error + Send + Sync>