pub struct Viewport {
pub collection: String,
pub seed_count: u32,
pub nodes: Vec<ViewportNode>,
pub edges: Vec<ViewportEdge>,
pub truncation: TruncationMeta,
}Expand description
A populated viewport response. Returned by the (future) runtime call and consumed directly by Red UI.
Fields§
§collection: String§seed_count: u32§nodes: Vec<ViewportNode>§edges: Vec<ViewportEdge>§truncation: TruncationMetaImplementations§
Source§impl Viewport
impl Viewport
Sourcepub fn from_visits(
request: &ViewportRequest,
visits: Vec<ViewportVisitInput>,
edges: Vec<ViewportEdge>,
) -> Viewport
pub fn from_visits( request: &ViewportRequest, visits: Vec<ViewportVisitInput>, edges: Vec<ViewportEdge>, ) -> Viewport
Pure builder: given an ordered visit list and the edge list
the traversal collected, apply ViewportRequest::node_limit
and produce the contract response.
The builder is intentionally pure so the truncation rule lives here once and is testable without a graph store. Runtime wiring (a follow-up slice) will call this after running the real traversal.
Rules:
- Visits are kept in input order. Callers (the traversal) are responsible for stable ordering — typically BFS by depth, then by node id.
- The first
node_limitvisits are returned; the remainder are reported viaTruncationMeta::dropped_node_countandTruncationMeta::node_limit_hit. - Edges are filtered down to those whose
sourceandtargetboth survived the node cap. An edge to a dropped node would be a dangling reference in the UI. depth_limit_hitis the OR of every surviving visit’sfrontier_truncated. A visit dropped by the node cap does not contribute (the UI will surface the node cap instead; re-asking with a larger node limit is the correct fix).
Trait Implementations§
impl StructuralPartialEq for Viewport
Auto Trait Implementations§
impl Freeze for Viewport
impl RefUnwindSafe for Viewport
impl Send for Viewport
impl Sync for Viewport
impl Unpin for Viewport
impl UnsafeUnpin for Viewport
impl UnwindSafe for Viewport
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request