Skip to main content

LibraryLayout

Struct LibraryLayout 

Source
pub struct LibraryLayout;
Expand description

The layout of a library’s files (modules.md, Libraries): a directory holding MARKER is a library’s root, a module path P names <root>/P.flow or <root>/contract/P.flow, and the root module, whose module path is empty, is lib.flow or contract/lib.flow.

Implementations§

Source§

impl LibraryLayout

Source

pub const MARKER: &'static str = "flow.toml"

The file whose presence makes a directory a library’s root.

Source

pub const CONTRACT: &'static str = "contract"

The directory, under a library’s root, that holds its contract modules.

Source

pub const ROOT: &'static str = "lib"

The stem of the root module’s file.

Source

pub const EXTENSION: &'static str = "flow"

The extension of a module’s file.

Source

pub fn marker(dir: &str) -> String

The path of dir’s marker, dir given from a tree’s root and empty for the root itself.

Source

pub fn file(stem: &str) -> String

The name of the file whose path without its extension is stem.

Source

pub fn stem(file: &str) -> Option<&str>

The path of the module file file without its extension; None for a file that is no module’s.

Source

pub fn placed_stem(module: &Segments) -> Segments

The path of module’s file without its extension, from the directory that holds the files of its placement: the library’s root for an authored module, its contract directory for a contract one. The root module’s is lib.

Source

pub fn placed_file(module: &Segments) -> String

The file of module, with its extension, from the directory that holds the files of its placement: lib.flow for the root module.

Source

pub fn placed_module(stem: &Segments) -> Segments

The module whose file, from the directory that holds the files of its placement and without its extension, is stem: the inverse of placed_stem.

Source

pub fn module_file(module: &Segments, placement: Placement) -> Segments

The file, inside its library and without its extension, that holds the module module in placement.

Source

pub fn module_of(file: &Segments) -> (Segments, Placement)

The module a file inside its library, without its extension, holds, and where: the inverse of module_file.

Source

pub fn spelled(module: &Segments) -> Option<Spelled>

How module, a module path as written inside a library, spells the layout, if it does.

Trait Implementations§

Source§

impl Debug for LibraryLayout

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.