Struct Module

Source
pub struct Module { /* private fields */ }
Expand description

Corresponds the grammar rule module.

Implementations§

Source§

impl Module

Source

pub fn empty(name: Identifier) -> Self

Source

pub fn new(name: Identifier, body: ModuleBody) -> Self

Source

pub fn with_source_file(self, source_file: PathBuf) -> Self

Source

pub fn with_base_uri(self, base_uri: Url) -> Self

Source

pub fn with_version_info<S>(self, version_info: S) -> Self
where S: Into<String>,

Source

pub fn with_version_uri(self, version_uri: Url) -> Self

Source

pub const fn has_source_file(&self) -> bool

Source

pub const fn source_file(&self) -> Option<&PathBuf>

Source

pub fn set_source_file(&mut self, source_file: PathBuf)

Source

pub fn unset_source_file(&mut self)

Source

pub const fn has_base_uri(&self) -> bool

Source

pub const fn base_uri(&self) -> Option<&HeaderValue<Url>>

Source

pub fn set_base_uri(&mut self, base_uri: HeaderValue<Url>)

Source

pub fn unset_base_uri(&mut self)

Source

pub const fn has_version_info(&self) -> bool

Source

pub const fn version_info(&self) -> Option<&HeaderValue<String>>

Source

pub fn set_version_info(&mut self, version_info: HeaderValue<String>)

Source

pub fn unset_version_info(&mut self)

Source

pub const fn has_version_uri(&self) -> bool

Source

pub const fn version_uri(&self) -> Option<&HeaderValue<Url>>

Source

pub fn set_version_uri(&mut self, version_uri: HeaderValue<Url>)

Source

pub fn unset_version_uri(&mut self)

Source

pub const fn has_file_id(&self) -> bool

Source

pub const fn file_id(&self) -> Option<&FileId>

Source

pub fn set_file_id(&mut self, file_id: FileId)

Source

pub fn unset_file_id(&mut self)

Source

pub fn imported_modules(&self) -> HashSet<&Identifier>

Source

pub fn imported_module_versions( &self, ) -> HashMap<&Identifier, Option<&HeaderValue<Url>>>

Source

pub fn imported_types(&self) -> HashSet<&QualifiedIdentifier>

Source

pub fn defined_names(&self) -> HashSet<&Identifier>

Source

pub fn is_incomplete(&self, cache: &InMemoryModuleCache) -> bool

Source

pub fn validate( &self, cache: &InMemoryModuleCache, loader: &impl ModuleLoader, check_constraints: bool, )

§Checks
  1. name is valid Identifier
  2. base URI is absolute Url
  3. version info string is not empty (warning)
  4. version URI is absolute Url
  5. body is valid
Source

pub fn is_library_module(&self) -> bool

Source

pub fn resolve_local(&self, name: &Identifier) -> Option<&Definition>

Trait Implementations§

Source§

impl Clone for Module

Source§

fn clone(&self) -> Module

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Module

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Module

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl HasBody for Module

Source§

type Body = ModuleBody

This type is the particular body for the enclosing type.
Source§

fn body(&self) -> &Self::Body

Get the body of the enclosing type.
Source§

fn body_mut(&mut self) -> &mut Self::Body

Get a mutable reference to the body of the enclosing type.
Source§

fn set_body(&mut self, body: Self::Body)

Set the body of the enclosing type.
Source§

impl HasName for Module

Source§

fn name(&self) -> &Identifier

Get the name of the enclosing type.
Source§

fn set_name(&mut self, name: Identifier)

Set the name of the enclosing type.
Source§

impl HasSourceSpan for Module

Source§

fn with_source_span(self, span: Span) -> Self

Source§

fn source_span(&self) -> Option<&Span>

Source§

fn set_source_span(&mut self, span: Span)

Source§

fn unset_source_span(&mut self)

Source§

fn has_source_span(&self) -> bool

Source§

impl References for Module

Source§

fn referenced_types<'a>(&'a self, names: &mut HashSet<&'a IdentifierReference>)

Source§

fn referenced_annotations<'a>( &'a self, names: &mut HashSet<&'a IdentifierReference>, )

Source§

impl Serialize for Module

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Module

§

impl RefUnwindSafe for Module

§

impl Send for Module

§

impl Sync for Module

§

impl Unpin for Module

§

impl UnwindSafe for Module

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T