pub struct DependencyEndpoint {
pub kind: ItemKind,
/* private fields */
}Expand description
One endpoint of a dependency edge.
Three forms: a native id of the source reporting it, a qualified <source>:<native> id,
and the opaque form — a Designator naming the tracker that holds the item and the
item’s native id there, which names a private item from a public one while conveying
nothing about it.
Fields§
§kind: ItemKindWhether the endpoint names a task or a project.
Implementations§
Source§impl DependencyEndpoint
impl DependencyEndpoint
Sourcepub fn new(id: String, kind: ItemKind) -> Result<Self, String>
pub fn new(id: String, kind: ItemKind) -> Result<Self, String>
Builds an endpoint from a serialized id, validating a qualified id when present.
§Errors
Returns an error for an empty id or a malformed <source>:<native> id.
Sourcepub fn opaque(
designator: Designator,
id: String,
kind: ItemKind,
) -> Result<Self, String>
pub fn opaque( designator: Designator, id: String, kind: ItemKind, ) -> Result<Self, String>
The opaque endpoint naming id, an item’s native id in the tracker designator names.
§Errors
Returns an error for an empty id.
Sourcepub fn from_value(value: &Value) -> Result<Self, EndpointRefusal>
pub fn from_value(value: &Value) -> Result<Self, EndpointRefusal>
Reads an endpoint from any of its three JSON forms, naming what about an object makes it none of them.
Unlike deserialization, which reads what a store already holds, this is for what a
caller asks to be written: an object carrying a key beyond designator, id and kind —
a title, a team, a URL — is refused with EndpointRefusal::Key naming that key, and
never its value.
§Errors
Sourcepub fn from_native(id: NativeId, kind: ItemKind) -> Self
pub fn from_native(id: NativeId, kind: ItemKind) -> Self
Builds an endpoint from a source-native id, whose contents are deliberately opaque.
Sourcepub fn id(&self) -> &str
pub fn id(&self) -> &str
The serialized native or qualified id — for the opaque form, the native id in the
tracker Self::designator names.
Sourcepub fn is_qualified(&self) -> bool
pub fn is_qualified(&self) -> bool
Whether the id was explicitly supplied as a qualified endpoint.
Sourcepub fn source(&self) -> Option<&str>
pub fn source(&self) -> Option<&str>
The source segment of a qualified id, or None for a native or an opaque one.
A native id belongs to whichever source reports it, so None reads as “this
source” rather than “no source” — ask Self::is_native before reading it that way,
because an opaque endpoint names no source of this configuration either.
Sourcepub fn is_native(&self) -> bool
pub fn is_native(&self) -> bool
Whether the id is a native id of the source reporting it: neither qualified nor opaque.
Sourcepub fn designator(&self) -> Option<&Designator>
pub fn designator(&self) -> Option<&Designator>
The tracker an opaque endpoint names, or None for the other two forms.
Trait Implementations§
Source§impl Clone for DependencyEndpoint
impl Clone for DependencyEndpoint
Source§impl Debug for DependencyEndpoint
impl Debug for DependencyEndpoint
Source§impl<'de> Deserialize<'de> for DependencyEndpoint
impl<'de> Deserialize<'de> for DependencyEndpoint
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>,
Source§impl Display for DependencyEndpoint
impl Display for DependencyEndpoint
impl Eq for DependencyEndpoint
Source§impl Hash for DependencyEndpoint
impl Hash for DependencyEndpoint
Source§impl JsonSchema for DependencyEndpoint
impl JsonSchema for DependencyEndpoint
Source§fn json_schema(_generator: &mut SchemaGenerator) -> Schema
fn json_schema(_generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for DependencyEndpoint
impl PartialEq for DependencyEndpoint
Source§impl PartialEq<NativeId> for DependencyEndpoint
An opaque endpoint names an item of another tracker, so it never equals a native id of the
source comparing it, whatever id it holds.
impl PartialEq<NativeId> for DependencyEndpoint
An opaque endpoint names an item of another tracker, so it never equals a native id of the source comparing it, whatever id it holds.