pub struct Resolved {
pub dir: String,
pub type_path: String,
pub require_fields: RequireFields,
pub module: Option<String>,
pub exclude: Vec<String>,
pub dts: Option<String>,
pub enforced_by: Option<String>,
pub declared_in: PathBuf,
pub declared_at: usize,
}Expand description
A contract as it applies: which directory, which type, which fields.
Fields§
§dir: StringDirectory relative to the project root, * in one segment expanding to every
subdirectory at that level ("sites/*").
type_path: String"<module>.<Type>", e.g. "defs.Mod" — the module that declares the record and
the path to it inside that module.
require_fields: RequireFieldsThe fields a module’s returned table must set, from ---@required.
module: Option<String>Only this module name in each matched dir is held to the contract.
exclude: Vec<String>Module names in the dir that are not held to the contract.
dts: Option<String>Where to publish the declaration, from ---@contract(dts = "…").
enforced_by: Option<String>Where this contract is enforced when the scan cannot see it, from
[[contract]] enforced_by. Not a marker argument: enforcement is the host’s
business, and the record is published to authors who have no use for the path.
declared_in: PathBufThe file the marker is in, and the line it is on: where to point when something about this contract is wrong.
declared_at: usizeImplementations§
Source§impl Resolved
impl Resolved
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 module (a file stem under a contract dir) held to this contract? The module
that declares the type is not held to it.
Trait Implementations§
impl Eq for Resolved
impl StructuralPartialEq for Resolved
Auto Trait Implementations§
impl Freeze for Resolved
impl RefUnwindSafe for Resolved
impl Send for Resolved
impl Sync for Resolved
impl Unpin for Resolved
impl UnsafeUnpin for Resolved
impl UnwindSafe for Resolved
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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