pub struct Reference {
pub type: String,
pub uri: Option<String>,
pub name: Option<String>,
}Expand description
Represents a reference to a resource or prompt. Umbrella type for both ResourceReference and PromptReference from the spec schema.
See the schema for details
Fields§
§type: StringThe type of content. Can be ref/resource or ref/prompt.
uri: Option<String>The URI or URI template of the resource.
name: Option<String>The name of the prompt or prompt template.
Implementations§
Source§impl Reference
impl Reference
Sourcepub fn validate(&self) -> Option<String>
pub fn validate(&self) -> Option<String>
Validates the reference object.
§Example
use neva::types::Reference;
// valid ref/resource
let reference = Reference::resource("file://test");
assert!(reference.validate().is_none());
// valid ref/prompt
let reference = Reference::prompt("test");
assert!(reference.validate().is_none())Trait Implementations§
Source§impl<'de> Deserialize<'de> for Reference
impl<'de> Deserialize<'de> for Reference
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
Auto Trait Implementations§
impl Freeze for Reference
impl RefUnwindSafe for Reference
impl Send for Reference
impl Sync for Reference
impl Unpin for Reference
impl UnwindSafe for Reference
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
Source§impl<T> FromRequest for Twhere
T: DeserializeOwned,
impl<T> FromRequest for Twhere
T: DeserializeOwned,
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.