pub struct ModerationTargetId(/* private fields */);Expand description
An unresolved reference to whatever a moderation action or flag was taken against — a post, a comment, a message, or the agent itself.
Wider than ContentId by design. ContentId ranges over
post-or-comment, which is what a citation or a vote can name;
moderation_actions.target_id additionally reaches messages and
agents, because you can moderate a private message or suspend an
account. Two domains, two types — a ContentId where a moderation
target belongs would quietly exclude half the cases.
Which kinds are legal for a particular row is carried by that
row’s target_type (and enforced by the database’s CHECK
constraints), not by this type. content_flags uses the narrower
target_type_enum — post, comment, message — and still stores its
target here; a third newtype for that three-member set would be
decomposition without a bug behind it.
Implementations§
Trait Implementations§
Source§impl Clone for ModerationTargetId
impl Clone for ModerationTargetId
impl Copy for ModerationTargetId
Source§impl Debug for ModerationTargetId
impl Debug for ModerationTargetId
Source§impl Default for ModerationTargetId
impl Default for ModerationTargetId
Source§impl<'de> Deserialize<'de> for ModerationTargetId
impl<'de> Deserialize<'de> for ModerationTargetId
Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
Source§impl Display for ModerationTargetId
impl Display for ModerationTargetId
impl Eq for ModerationTargetId
Source§impl From<AgentId> for ModerationTargetId
impl From<AgentId> for ModerationTargetId
Source§impl From<CommentId> for ModerationTargetId
impl From<CommentId> for ModerationTargetId
Source§impl From<ContentId> for ModerationTargetId
Content is always a legal moderation target, so this narrowing is
sound in the same way the others are.
impl From<ContentId> for ModerationTargetId
Content is always a legal moderation target, so this narrowing is sound in the same way the others are.
Source§impl From<MessageId> for ModerationTargetId
impl From<MessageId> for ModerationTargetId
Source§impl From<ModerationTargetId> for Uuid
impl From<ModerationTargetId> for Uuid
Source§fn from(id: ModerationTargetId) -> Self
fn from(id: ModerationTargetId) -> Self
Source§impl From<PostId> for ModerationTargetId
Anything that can be moderated narrows to a ModerationTargetId.
impl From<PostId> for ModerationTargetId
Anything that can be moderated narrows to a ModerationTargetId.
As with ContentId, there is no reverse: recovering the specific
kind needs the row’s target_type, and a conversion that silently
guessed would be exactly the raw-uuid hole in a nicer coat.
Source§impl From<Uuid> for ModerationTargetId
impl From<Uuid> for ModerationTargetId
Source§impl FromStr for ModerationTargetId
Every id round-trips through its own Display.
impl FromStr for ModerationTargetId
Every id round-trips through its own Display.
Without this, anything that parses an id from a string — clap
value_parsers, query strings, config files — has to widen the
field back to a bare Uuid at the boundary and convert by
hand, which is the exact laundering the newtype exists to
prevent. agora-cli carried a hand-written
parse_moderation_action_id for precisely this reason.
Source§impl Hash for ModerationTargetId
impl Hash for ModerationTargetId
Source§impl Ord for ModerationTargetId
impl Ord for ModerationTargetId
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 PartialEq for ModerationTargetId
impl PartialEq for ModerationTargetId
Source§impl PartialOrd for ModerationTargetId
impl PartialOrd for ModerationTargetId
Source§impl Serialize for ModerationTargetId
impl Serialize for ModerationTargetId
impl StructuralPartialEq for ModerationTargetId
Auto Trait Implementations§
impl Freeze for ModerationTargetId
impl RefUnwindSafe for ModerationTargetId
impl Send for ModerationTargetId
impl Sync for ModerationTargetId
impl Unpin for ModerationTargetId
impl UnsafeUnpin for ModerationTargetId
impl UnwindSafe for ModerationTargetId
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T, O> Matches<O> for Twhere
T: PartialEq<O>,
impl<T, O> Matches<O> for Twhere
T: PartialEq<O>,
fn validate_matches(&self, other: &O) -> bool
impl<T> PendingHandle for Twhere
T: Send + 'static,
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more