pub struct Contract {
pub dir: String,
pub type_path: String,
pub require_fields: bool,
pub exclude: Vec<String>,
pub module: Option<String>,
}Fields§
§dir: StringDirectory relative to htl.toml, e.g. "mods". One path segment may be *
("sites/*"): every subdirectory at that level is a contract directory.
type_path: String"<module>.<Type>", e.g. "defs.Mod".
require_fields: boolEvery declared field must appear in the module’s returned table literal.
exclude: Vec<String>Module names (file stems) inside dir that are not held to the contract, e.g.
an SDK the host writes there (defs, modkit). The module that declares type
is always exempt.
module: Option<String>When set, only this module name (in each matched dir) is held to the contract.
Implementations§
Source§impl Contract
impl Contract
Sourcepub fn dirs(&self, root: &Path) -> Vec<PathBuf>
pub fn dirs(&self, root: &Path) -> Vec<PathBuf>
Concrete contract directories under root (expands one * segment). Missing
directories are dropped; a literal dir that does not exist yields nothing.
Sourcepub fn applies_to(&self, module: &str) -> bool
pub fn applies_to(&self, module: &str) -> bool
Is a module with this name (file stem) held to the contract?
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Contract
impl<'de> Deserialize<'de> for Contract
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Contract
impl RefUnwindSafe for Contract
impl Send for Contract
impl Sync for Contract
impl Unpin for Contract
impl UnsafeUnpin for Contract
impl UnwindSafe for Contract
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more