module std::disposesource
Values that must be released by a call, not only freed.
Disposable is a lang item (LANGUAGE_SPEC.md section 6.1a) at the
canonical path std::dispose::Disposable. A type declaring it stands for
something outside memory, such as a file or a lock: the compiler checks
that each of its values is disposed or moved away on every path before
its scope ends, and that none is copied (section 5.2). It never calls
dispose itself; defer value.dispose(); is the usual way to call it.
interface Disposablesource
exp interface Disposable
Required functions
fn dispose(self: &var);
Implemented by
exp type MappedFile : Disposable = structexp type File : Disposable = structexp type Entry<K, V> : Disposable if (V: Disposable) = structexp type Map<K: Key, V> : Disposable if (V: Disposable) = structexp type Option<T> : Disposable if (T: Disposable) + Format if (T: Format) = enumexp type Mutex<T> : Shared + Disposable if (T: Disposable) = structexp type Guard<T> : Disposable = structexp type Channel<T> : Shared + Disposable if (T: Disposable) = structexp type Vector<T> : Iterable<T, VectorCursor<T>> + Disposable if ( T: Disposable ) + Equal + Format if (T: Format) = struct