pub struct FrameSources { /* private fields */ }Expand description
The frame sources an operator registered, by name, and the watches running on them
(spec 3.7 §7.8, §7.10): the registry behind the vision_watch tool.
A source streams only while a watch condition is registered on it. The first condition
starts its StreamPipeline with a StreamWatch as the sink; later ones join the
running watch; removing the last one stops the stream. Each stream runs under the
registry’s own VisionCx — its audit trail, metering scope and kill switch — with a
cancellation token of its own, so it outlives the tool call that started it and a freeze
pauses it at its next frame (V-I17). A stream that ends on its own, such as a file’s last
frame, keeps its conditions registered; the next registration starts it again.
| Record | Written to | When |
|---|---|---|
vision.watch.registered | the caller’s trail, else the registry’s | a condition is registered |
vision.watch.stopped | the caller’s trail, else the registry’s | a condition is removed |
vision.source.started, .stopped, .paused, .resumed, vision.governor.step | the registry’s trail | the stream’s life |
vision.evidence.kept, vision.watch.fired | the registry’s trail | an event’s frame is kept and delivered |
§Example
use adk_vision::VisionCx;
use adk_vision::stream::FrameSources;
let sources = FrameSources::new(VisionCx::new());
assert!(sources.statuses().is_empty());Implementations§
Source§impl FrameSources
impl FrameSources
Sourcepub fn new(cx: VisionCx) -> Self
pub fn new(cx: VisionCx) -> Self
A registry whose streams run under cx: its audit trail, metering scope and kill
switch. Cancelling cx stops every stream.
Sourcepub fn register(&self, spec: SourceSpec) -> Result<()>
pub fn register(&self, spec: SourceSpec) -> Result<()>
Registers a source under its FrameSource::id.
§Errors
VisionError::InvalidInput when a source of that name is already registered.
Sourcepub fn names(&self) -> Vec<FrameSourceId>
pub fn names(&self) -> Vec<FrameSourceId>
The registered sources’ names.
Sourcepub fn statuses(&self) -> Vec<SourceStatus>
pub fn statuses(&self) -> Vec<SourceStatus>
Every source’s status.
Sourcepub fn status(&self, source: &FrameSourceId) -> Result<SourceStatus>
pub fn status(&self, source: &FrameSourceId) -> Result<SourceStatus>
Sourcepub async fn start_watch(
&self,
cx: &VisionCx,
source: &FrameSourceId,
condition: WatchCondition,
) -> Result<WatchOutcome>
pub async fn start_watch( &self, cx: &VisionCx, source: &FrameSourceId, condition: WatchCondition, ) -> Result<WatchOutcome>
Registers condition on source, starting its stream if none runs. Registering the
same condition again changes nothing; a different condition under a registered name
is refused.
§Errors
VisionError::InvalidInput for an unknown source, an invalid condition, one naming
labels the source’s detector never reports, or a name already registered with other
settings; the stream’s build error; the audit trail’s error when it fails closed.
Sourcepub async fn stop_watch(
&self,
cx: &VisionCx,
source: &FrameSourceId,
name: &str,
) -> Result<WatchOutcome>
pub async fn stop_watch( &self, cx: &VisionCx, source: &FrameSourceId, name: &str, ) -> Result<WatchOutcome>
Removes the condition named name from source; removing the last one stops the
stream and waits for it to finish.
§Errors
VisionError::InvalidInput for an unknown source; the audit trail’s error when it
fails closed.
Trait Implementations§
Source§impl Clone for FrameSources
impl Clone for FrameSources
Auto Trait Implementations§
impl !RefUnwindSafe for FrameSources
impl !UnwindSafe for FrameSources
impl Forget for FrameSources
impl Freeze for FrameSources
impl Move for FrameSources
impl Send for FrameSources
impl Sync for FrameSources
impl Unpin for FrameSources
impl UnsafeUnpin for FrameSources
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<T> Downcast for T
impl<T> Downcast for T
impl<T> ErasedDestructor for Twhere
T: 'static,
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> ⓘ
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> ⓘ
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<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
impl<T> MaybeSend for Twhere
T: Send,
Source§impl<T> Pointable for T
impl<T> Pointable for T
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.