pub struct Contract {
pub dir: String,
pub module: Option<String>,
pub exclude: Vec<String>,
pub enforced_by: Option<String>,
}Expand description
[[contract]] — where this project accepts modules from outside it. One line, in the
file a reader opens first; the shape those modules must have is declared on the record
itself with ---@contract (see crate::contract).
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.
module: Option<String>When set, only this module name (in each matched dir) is held to the contract.
---@contract(module = "…") says the same thing on the record.
exclude: Vec<String>Module names (file stems) inside dir that are not held to the contract: a
helper, or an SDK the host writes there. A declaration (.d.tl) is never held to
a contract and does not need listing; a .tl beside the modules does.
---@contract(exclude = "a b") says the same thing on the record.
enforced_by: Option<String>Where this contract is enforced at run time, when it is somewhere htl check
cannot see: a Lua-side validator, a resolver in a sibling crate, generated code,
or a resolver built by hand. Relative to htl.toml (~ and absolute paths
resolve as [check] paths does). Turns contract-unenforced off for this
contract and no other.
A path rather than a flag on purpose: the file has to exist, so the claim is one the check can hold to something, and a missing one is reported under the same rule. This is not a per-contract off switch.
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>,
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
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> ⓘ
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> ⓘ
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