pub struct RustOrigin {
pub package: Option<(&'static str, &'static str)>,
pub code: Option<RustCode>,
}
Expand description
A pointer to a specific location in the Rust source code.
This object points to a particular place in a Rust file and represents the origin of an exported Rust construct or a part of it.
Typically, you don’t need to create this object manually. The
export macro generates static instances of RustOrigin
during the introspection of Rust items. These instances are created in
static memory by the export system. Therefore, you would generally use
&'static RustOrigin
references wrapped in Origin.
Fields§
§package: Option<(&'static str, &'static str)>
The name and version of the crate to which the Rust file belongs.
code: Option<RustCode>
The actual reference to the Rust file within the crate.
Implementations§
Source§impl RustOrigin
impl RustOrigin
Sourcepub fn nil() -> &'static Self
pub fn nil() -> &'static Self
Returns a RustOrigin that intentionally does not point to any Rust code. This is the Default value of this object.
Sourcepub fn is_nil(&self) -> bool
pub fn is_nil(&self) -> bool
Returns true if this instance is the Nil RustOrigin.
Sourcepub fn package(&self) -> Option<&'static PackageMeta>
pub fn package(&self) -> Option<&'static PackageMeta>
Returns the script package metadata of the crate that this RustOrigin points to.
Returns None if the package is not specified or if the crate is not a script package.
Trait Implementations§
Source§impl Clone for RustOrigin
impl Clone for RustOrigin
Source§fn clone(&self) -> RustOrigin
fn clone(&self) -> RustOrigin
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for RustOrigin
impl Debug for RustOrigin
Source§impl Default for RustOrigin
impl Default for RustOrigin
Source§impl Display for RustOrigin
impl Display for RustOrigin
Source§impl From<&'static RustOrigin> for Origin
impl From<&'static RustOrigin> for Origin
Source§fn from(value: &'static RustOrigin) -> Self
fn from(value: &'static RustOrigin) -> Self
Source§impl Hash for RustOrigin
impl Hash for RustOrigin
Source§impl Ord for RustOrigin
impl Ord for RustOrigin
Source§fn cmp(&self, other: &RustOrigin) -> Ordering
fn cmp(&self, other: &RustOrigin) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for RustOrigin
impl PartialEq for RustOrigin
Source§impl PartialOrd for RustOrigin
impl PartialOrd for RustOrigin
impl Copy for RustOrigin
impl Eq for RustOrigin
Auto Trait Implementations§
impl Freeze for RustOrigin
impl RefUnwindSafe for RustOrigin
impl Send for RustOrigin
impl Sync for RustOrigin
impl Unpin for RustOrigin
impl UnwindSafe for RustOrigin
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<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString
. Read more