pub struct Address { /* private fields */ }Expand description
The nouns of the plugin contract that appear in the engine’s answers, so
an interface needs nothing but this crate.
A position in a language’s namespace: the package it belongs to and the
path within it — fff :: [grep, types] for a Rust module, path
components for a TypeScript file. Prefix relations, which are what a move
cares about, never hold across packages.
Implementations§
Source§impl Address
impl Address
pub fn new( package: impl Into<PackageId>, path: impl IntoIterator<Item = impl Into<Name>>, ) -> Address
Sourcepub fn root(package: impl Into<PackageId>) -> Address
pub fn root(package: impl Into<PackageId>) -> Address
The package itself: a crate root, a TypeScript package directory.
pub fn package(&self) -> &PackageId
pub fn path(&self) -> &[Name]
pub fn is_root(&self) -> bool
pub fn starts_with(&self, prefix: &Address) -> bool
pub fn join(&self, segment: impl Into<Name>) -> Address
pub fn extend(&self, rest: impl IntoIterator<Item = impl Into<Name>>) -> Address
Sourcepub fn rebase(&self, from: &Address, to: &Address) -> Option<Address>
pub fn rebase(&self, from: &Address, to: &Address) -> Option<Address>
Replace the leading from with to. None when self is not under from.
Sourcepub fn strip_prefix(&self, prefix: &Address) -> Option<&[Name]>
pub fn strip_prefix(&self, prefix: &Address) -> Option<&[Name]>
Segments after prefix, if self is under it (same package).
Sourcepub fn lowest_common_ancestor(&self, other: &Address) -> Option<Address>
pub fn lowest_common_ancestor(&self, other: &Address) -> Option<Address>
The deepest position both are under; None across packages.
Sourcepub fn display_with(&self, separator: &str) -> String
pub fn display_with(&self, separator: &str) -> String
The path within the package, joined; the package is not shown.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Address
impl<'de> Deserialize<'de> for Address
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Address, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Address, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Display for Address
package::a::b; a nameless package (a lone TypeScript root) is left out
rather than shown as a leading ::.
impl Display for Address
package::a::b; a nameless package (a lone TypeScript root) is left out
rather than shown as a leading ::.
impl Eq for Address
Source§impl Ord for Address
impl Ord for Address
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Address
impl PartialOrd for Address
Source§impl Serialize for Address
impl Serialize for Address
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Address
Auto Trait Implementations§
impl Freeze for Address
impl RefUnwindSafe for Address
impl Send for Address
impl Sync for Address
impl Unpin for Address
impl UnsafeUnpin for Address
impl UnwindSafe for Address
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