pub struct VisualInputs { /* private fields */ }Expand description
The gate every camera and screen frame passes before it reaches the provider (spec 3.3 §5.6).
§Example
use adk_surface::voice::{FramePolicy, VisualInputs, VisualSource};
use tokio::time::Instant;
let mut gate = VisualInputs::new(FramePolicy::GEMINI);
let now = Instant::now();
assert!(!gate.offer(VisualSource::Screen, b"frame", now), "off: dropped");
gate.switch(VisualSource::Screen, true);
assert!(gate.offer(VisualSource::Screen, b"frame", now));
gate.switch(VisualSource::Screen, false);
assert!(!gate.offer(VisualSource::Screen, b"frame", now + std::time::Duration::from_secs(5)));Implementations§
Source§impl VisualInputs
impl VisualInputs
Sourcepub fn new(policy: FramePolicy) -> Self
pub fn new(policy: FramePolicy) -> Self
Both switches off.
Sourcepub fn switch(&mut self, source: VisualSource, on: bool)
pub fn switch(&mut self, source: VisualSource, on: bool)
Turns source on or off. Off forgets the last frame, so the first frame after the next
on is new.
Sourcepub fn is_on(&self, source: VisualSource) -> bool
pub fn is_on(&self, source: VisualSource) -> bool
Whether source is on.
Trait Implementations§
Source§impl Clone for VisualInputs
impl Clone for VisualInputs
Auto Trait Implementations§
impl Forget for VisualInputs
impl Freeze for VisualInputs
impl Move for VisualInputs
impl RefUnwindSafe for VisualInputs
impl Send for VisualInputs
impl Sync for VisualInputs
impl Unpin for VisualInputs
impl UnsafeUnpin for VisualInputs
impl UnwindSafe for VisualInputs
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> 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<'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
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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 more