pub struct Namespace {
pub name: Arc<str>,
pub interns: Mutex<HashMap<Arc<str>, GcPtr<Var>>>,
pub refers: Mutex<HashMap<Arc<str>, GcPtr<Var>>>,
pub aliases: Mutex<HashMap<Arc<str>, Arc<str>>>,
pub source_file: Mutex<Option<Arc<str>>>,
pub git_repo_root: Mutex<Option<Arc<str>>>,
pub is_versioned: bool,
pub meta: Mutex<Option<Value>>,
}Expand description
A Clojure namespace with intern table, refers, and aliases.
Fields§
§name: Arc<str>§interns: Mutex<HashMap<Arc<str>, GcPtr<Var>>>Vars interned directly in this namespace.
refers: Mutex<HashMap<Arc<str>, GcPtr<Var>>>Vars referred from other namespaces (e.g. clojure.core).
aliases: Mutex<HashMap<Arc<str>, Arc<str>>>Namespace aliases: short-name → full namespace name.
source_file: Mutex<Option<Arc<str>>>Absolute path of the source file this namespace was loaded from,
populated by the loader. Used by the versioned resolver to locate the
file for git show.
git_repo_root: Mutex<Option<Arc<str>>>Absolute path of the git repository root that contains source_file.
is_versioned: booltrue for namespaces loaded from a specific commit (name@hash).
Versioned namespaces are immutable: intern() will refuse new bindings.
meta: Mutex<Option<Value>>Metadata attached via (ns ^{...} name ...) or an ns attr-map.
Implementations§
Source§impl Namespace
impl Namespace
pub fn new(name: impl Into<Arc<str>>) -> Self
Sourcepub fn new_versioned(name: impl Into<Arc<str>>) -> Self
pub fn new_versioned(name: impl Into<Arc<str>>) -> Self
Create a versioned (immutable) namespace for name@commit.
Sourcepub fn set_source_location(&self, file: &str, repo_root: Option<&str>)
pub fn set_source_location(&self, file: &str, repo_root: Option<&str>)
Record the source file path and its git repo root (if in a repo).
pub fn get_meta(&self) -> Option<Value>
pub fn set_meta(&self, m: Value)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Namespace
impl !Send for Namespace
impl !Sync for Namespace
impl RefUnwindSafe for Namespace
impl Unpin for Namespace
impl UnsafeUnpin for Namespace
impl UnwindSafe for Namespace
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more