pub enum Location {
Url(String),
Path(String),
}Expand description
Where an entity is, in the one form a consumer can act on without knowing the backend.
Externally tagged with exactly two variants, so the JSON is {"url": "https://…"} or
{"path": "/home/…"} and a consumer tells them apart by which key is present. A reader
handed one of these knows what to do with it — open a link, or print a path and read
the file out — which is what a bare string could not have said.
It carries no third case on purpose. None on the field is the third case, and it
means the source did not say where the entity is, which is not the same as saying it is
nowhere.
This does not redefine, replace or derive from the url field of Task,
Project or Document: a source that reports a web URL there goes on reporting
it, and every existing consumer sees exactly what it saw.
Variants§
Url(String)
The entity lives at an external website, and this is a link a reader can open.
Path(String)
The entity is a file on the machine the source runs on, and this is that file’s absolute path, so a reader can print the path or read the contents out.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Location
impl<'de> Deserialize<'de> for Location
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>,
impl Eq for Location
Source§impl JsonSchema for Location
impl JsonSchema for Location
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
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 more