pub struct ExternalSource { /* private fields */ }Expand description
A normalized external source returned by search or another hosted tool.
Implementations§
Source§impl ExternalSource
impl ExternalSource
Sourcepub fn new(url: impl Into<String>) -> Result<Self, ExternalContentError>
pub fn new(url: impl Into<String>) -> Result<Self, ExternalContentError>
Creates a source with a bounded HTTP(S) URL.
§Errors
Returns an error for non-HTTP(S), empty, oversized, or control-containing URLs.
Sourcepub fn with_title(
self,
title: impl Into<String>,
) -> Result<Self, ExternalContentError>
pub fn with_title( self, title: impl Into<String>, ) -> Result<Self, ExternalContentError>
Adds a bounded, control-free source title.
§Errors
Returns an error when the title is empty, oversized, or contains controls.
Sourcepub fn with_snippet(
self,
snippet: impl Into<String>,
) -> Result<Self, ExternalContentError>
pub fn with_snippet( self, snippet: impl Into<String>, ) -> Result<Self, ExternalContentError>
Adds a bounded source snippet.
§Errors
Returns an error when the snippet is empty, oversized, or contains a null character.
Trait Implementations§
Source§impl Clone for ExternalSource
impl Clone for ExternalSource
Source§fn clone(&self) -> ExternalSource
fn clone(&self) -> ExternalSource
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ExternalSource
impl Debug for ExternalSource
Source§impl<'de> Deserialize<'de> for ExternalSource
impl<'de> Deserialize<'de> for ExternalSource
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for ExternalSource
Source§impl PartialEq for ExternalSource
impl PartialEq for ExternalSource
Source§impl Serialize for ExternalSource
impl Serialize for ExternalSource
impl StructuralPartialEq for ExternalSource
Auto Trait Implementations§
impl Freeze for ExternalSource
impl RefUnwindSafe for ExternalSource
impl Send for ExternalSource
impl Sync for ExternalSource
impl Unpin for ExternalSource
impl UnsafeUnpin for ExternalSource
impl UnwindSafe for ExternalSource
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