pub trait ParentResolver:
Send
+ Sync
+ 'static {
// Required methods
fn parent(&self, event: &KernelEvent) -> Option<ThreadPointer>;
fn root(&self, event: &KernelEvent) -> Option<ThreadPointer>;
fn parent_author(&self, event: &KernelEvent) -> Option<String>;
// Provided method
fn supersedes(&self, _event: &KernelEvent) -> Option<EventId> { ... }
}Expand description
Resolve thread relationships from a KernelEvent. Implementors are
per-NIP and stateless — the grouper owns its own state.
Required Methods§
Sourcefn parent(&self, event: &KernelEvent) -> Option<ThreadPointer>
fn parent(&self, event: &KernelEvent) -> Option<ThreadPointer>
Direct parent — the thing this event replies to. None for top-level
events that aren’t part of a thread.
Sourcefn root(&self, event: &KernelEvent) -> Option<ThreadPointer>
fn root(&self, event: &KernelEvent) -> Option<ThreadPointer>
Thread root — the original anchor (article, note, URI). For top-level
replies this may equal parent. None when the event is itself a
root or when no root marker is decodable.
Pubkey of the parent’s author, when recoverable from the event’s p
tags. Optional — used by UI for “X replied to Y” stitching; the
grouper itself does not consult this.
Provided Methods§
Sourcefn supersedes(&self, _event: &KernelEvent) -> Option<EventId>
fn supersedes(&self, _event: &KernelEvent) -> Option<EventId>
Event id this event supersedes in the block layout, if any.
Used for feed-composition rules where one event should replace (not extend) another in the displayed block list — the canonical case is a NIP-18 repost whose target note is already in the feed. The grouper removes the named block before placing this event, so the reposted note bumps to the new event’s position and renders once.
Default None: parent edges, not supersession, is the common case.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".