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>>,
pub refer_clojure_filter: Mutex<Option<ReferClojureFilter>>,
}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.
refer_clojure_filter: Mutex<Option<ReferClojureFilter>>Narrowing applied to the automatic clojure.core refer, set by an
(:refer-clojure ...) clause. None refers all of core.
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).