#[non_exhaustive]pub struct CodeDescription {
pub href: Url,
}Expand description
An advisory/rule URL attached to a Diagnostic’s code, field-for-field identical to
tower_lsp_server::ls_types::CodeDescription but carrying no dependency on
tower-lsp-server.
§Examples
use deps_core::diagnostic::CodeDescription;
use url::Url;
let href = Url::parse("https://osv.dev/GHSA-xxxx").unwrap();
let code_description = CodeDescription::new(href.clone());
assert_eq!(code_description.href, href);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.href: UrlURI describing the diagnostic’s code, e.g. an OSV advisory page.
Implementations§
Source§impl CodeDescription
impl CodeDescription
Sourcepub const fn new(href: Url) -> Self
pub const fn new(href: Url) -> Self
Builds a CodeDescription from its href field.
Needed because Self is #[non_exhaustive]: a struct literal only works inside
this crate, so every other crate must call this constructor instead.
§Examples
use deps_core::diagnostic::CodeDescription;
use url::Url;
let code_description = CodeDescription::new(Url::parse("https://example.com").unwrap());
assert_eq!(code_description.href.as_str(), "https://example.com/");Trait Implementations§
Source§impl Clone for CodeDescription
impl Clone for CodeDescription
Source§impl Debug for CodeDescription
impl Debug for CodeDescription
impl Eq for CodeDescription
Source§impl PartialEq for CodeDescription
impl PartialEq for CodeDescription
impl StructuralPartialEq for CodeDescription
Auto Trait Implementations§
impl Freeze for CodeDescription
impl RefUnwindSafe for CodeDescription
impl Send for CodeDescription
impl Sync for CodeDescription
impl Unpin for CodeDescription
impl UnsafeUnpin for CodeDescription
impl UnwindSafe for CodeDescription
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> 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§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.