pub struct SourceRef { /* private fields */ }Expand description
A source backing a streamed answer, shown as a chip under the text.
A source with a URL becomes an activatable chip that reports
StreamingTextEvent::SourceActivated; its domain initial doubles as a
favicon-style badge so a row of sources scans at a glance.
Implementations§
Source§impl SourceRef
impl SourceRef
Sourcepub fn new(title: impl Into<SharedString>) -> Self
pub fn new(title: impl Into<SharedString>) -> Self
Creates a source chip with a display title; the title doubles as its stable identifier.
Sourcepub fn with_id(
id: impl Into<SharedString>,
title: impl Into<SharedString>,
) -> Self
pub fn with_id( id: impl Into<SharedString>, title: impl Into<SharedString>, ) -> Self
Creates a source with an explicit stable identifier.
Sourcepub fn url(self, url: impl Into<SharedString>) -> Self
pub fn url(self, url: impl Into<SharedString>) -> Self
Adds the source’s location; the chip becomes activatable and shows the domain’s initial as its badge.
Sourcepub fn id(&self) -> &SharedString
pub fn id(&self) -> &SharedString
Returns the stable source identifier.
Sourcepub fn title(&self) -> &SharedString
pub fn title(&self) -> &SharedString
Returns the display title.
Sourcepub fn url_text(&self) -> Option<&SharedString>
pub fn url_text(&self) -> Option<&SharedString>
Returns the location, when set.
Trait Implementations§
impl Eq for SourceRef
impl StructuralPartialEq for SourceRef
Auto Trait Implementations§
impl Freeze for SourceRef
impl RefUnwindSafe for SourceRef
impl Send for SourceRef
impl Sync for SourceRef
impl Unpin for SourceRef
impl UnsafeUnpin for SourceRef
impl UnwindSafe for SourceRef
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
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<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
Compare self to
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> 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