pub struct ModulePath { /* private fields */ }Expand description
Where a module is, as a code.ModulePath writes it (code.md,
Programs and modules): its tree, the root of the library it belongs to
in that tree, and its module path in that library. A module outside
every library has no library, and its path is its file’s from the
tree’s root, without .flow.
A module path names no version: one program reaches one version of each tree, so where a version is written it is held beside the path.
Implementations§
Source§impl ModulePath
impl ModulePath
Sourcepub fn new(
tree: Tree,
library: Option<Segments>,
segments: Segments,
) -> ModulePath
pub fn new( tree: Tree, library: Option<Segments>, segments: Segments, ) -> ModulePath
The module at segments in the library at library of tree, or
outside every library when library is None.
Sourcepub fn submitted() -> ModulePath
pub fn submitted() -> ModulePath
The module a lone submitted file is: main of a one-file bundle
(abi.md, Identity and signatures).
Sourcepub fn of_file(
tree: Tree,
library: Option<Segments>,
file: &Segments,
) -> (ModulePath, Placement)
pub fn of_file( tree: Tree, library: Option<Segments>, file: &Segments, ) -> (ModulePath, Placement)
The module the file file of tree, given from the tree’s root
without its extension, holds in the library at library, and
which of its module path’s files it is.
Sourcepub fn library(&self) -> Option<&Segments>
pub fn library(&self) -> Option<&Segments>
The root of its library in its tree, the empty path for the tree’s
own root; None outside every library.
Sourcepub fn segments(&self) -> &Segments
pub fn segments(&self) -> &Segments
Its module path in its library, or outside every library its file’s path from its tree’s root.
Sourcepub fn file(&self, placement: Placement) -> Segments
pub fn file(&self, placement: Placement) -> Segments
The file of its tree, without its extension, that holds it in
placement.
Sourcepub fn logical(&self) -> Segments
pub fn logical(&self) -> Segments
The path inside its tree its imports write it by: its library’s root followed by its module path.
Sourcepub fn address(&self) -> String
pub fn address(&self) -> String
Its library’s address, or for a module outside every library its
tree’s (abi.md, Identity and signatures): std for every
library std holds, a repository, github.com/acme/tools/payments,
tools, . for a library at the local tree’s root, or empty for a
module of the local tree outside every library.
Sourcepub fn module(&self) -> Segments
pub fn module(&self) -> Segments
Its module path inside address. std is one
library named std, so a module of a library inside it is that
library’s root followed by its module path there, as clock for
clock/contract/lib.
Sourcepub fn written(&self, version: Option<&str>) -> String
pub fn written(&self, version: Option<&str>) -> String
The module as identities write it: its address, @version when
version is given, then its module path, each part that is empty
left out with its separator. A library at the local tree’s root is
written as the tree’s own modules are, by the path from that root.