pub struct CommentOrigin {
pub task: String,
pub id: NativeId,
pub author: Option<String>,
pub created_at: Option<DateTime<Utc>>,
pub updated_at: Option<DateTime<Utc>>,
pub url: Option<String>,
}Expand description
Where a copied comment came from: the comment as its origin holds it.
Fields§
§task: StringThe task the comment is on at its origin, qualified: <source>:<native task id>.
id: NativeIdThe comment’s own id at its origin.
Who wrote it there, in that source’s spelling of a person.
created_at: Option<DateTime<Utc>>When the origin says it was written.
updated_at: Option<DateTime<Utc>>When the origin says it last changed.
url: Option<String>Where a person can open it at its origin.
Implementations§
Source§impl CommentOrigin
impl CommentOrigin
Sourcepub fn is_qualified_task(task: &str) -> bool
pub fn is_qualified_task(task: &str) -> bool
Whether task is a qualified task id — <source>:<native task id>, the source a valid
source name and the native id not empty — and so can be an origin’s task.
What a reader holds to before it takes a stored origin as one: the origin’s task decides which copies a sync owns, edits and deletes, and which comments it never sends back, so one naming no task is no origin at all and is read as the text it was stored as.
Sourcepub fn qualified(&self) -> Result<&Self, SourceError>
pub fn qualified(&self) -> Result<&Self, SourceError>
This origin, refused as SourceError::Malformed when its task is not a qualified task
id — what every writer of a copied comment holds an origin to before it writes one, since
such an origin would be stored and then read back as none.
§Errors
SourceError::Malformed, naming the task it was given.
Sourcepub fn mark(&self, body: &str) -> String
pub fn mark(&self, body: &str) -> String
body with this origin appended as a hidden marker, for a source that cannot store a
comment’s origin, author or times natively.
One line, an HTML comment whose payload is compact JSON inside a code span —
<!-- onetaskgraph.comment_origin `{…}` --> — because that is the spelling both
hosted services this product drives keep byte for byte (the Linear plugin’s module
documentation records what Linear does to every other one). <, > and ` are
escaped inside the JSON, where the escape means the same character, so no value can
close the marker early.
Source§impl CommentOrigin
impl CommentOrigin
Sourcepub fn kept(held: &str, body: &CommentBody) -> Result<CommentBody, SourceError>
pub fn kept(held: &str, body: &CommentBody) -> Result<CommentBody, SourceError>
body, carrying over the hidden marker the comment it replaces ends in — held, that
comment’s body exactly as its source holds it — when body ends in none of its own.
What a source that keeps a copied comment’s origin as the marker answers an edit with:
an edit changes what a comment says and nothing else, so a comment a copy wrote is still
that copy afterwards, and the next copy keeps it in step rather than writing another
beside it. A body that ends in a marker of its own — a copy rewriting its own comment —
is left as it is.
§Errors
None in practice, because the body only grows: SourceError::Refused is what
CommentBody::new answers an empty text with.
Trait Implementations§
Source§impl Clone for CommentOrigin
impl Clone for CommentOrigin
Source§impl Debug for CommentOrigin
impl Debug for CommentOrigin
Source§impl<'de> Deserialize<'de> for CommentOrigin
impl<'de> Deserialize<'de> for CommentOrigin
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 CommentOrigin
Source§impl JsonSchema for CommentOrigin
impl JsonSchema for CommentOrigin
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