#[non_exhaustive]pub struct MetaTag {
pub name: String,
pub content: String,
}Expand description
One <meta> element: its identifier and content.
§Example
use metadata_gen::MetaTag;
let tag = MetaTag::new("og:title", r#"Fish & "Chips""#);
assert_eq!(
tag.render(),
r#"<meta property="og:title" content="Fish & "Chips"">"#
);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.name: StringThe tag’s identifier (description, og:title, twitter:card).
content: StringThe tag’s content.
Implementations§
Source§impl MetaTag
impl MetaTag
Sourcepub fn new(name: impl Into<String>, content: impl Into<String>) -> Self
pub fn new(name: impl Into<String>, content: impl Into<String>) -> Self
Creates a tag from its identifier and content.
Sourcepub fn attribute(&self) -> MetaAttribute
pub fn attribute(&self) -> MetaAttribute
The attribute this tag’s identifier belongs in.
§Example
use metadata_gen::metatags::{MetaAttribute, MetaTag};
assert_eq!(MetaTag::new("og:image", "x").attribute(), MetaAttribute::Property);
assert_eq!(MetaTag::new("twitter:card", "x").attribute(), MetaAttribute::Name);
assert_eq!(MetaTag::new("refresh", "x").attribute(), MetaAttribute::Name);Trait Implementations§
impl Eq for MetaTag
impl StructuralPartialEq for MetaTag
Auto Trait Implementations§
impl Freeze for MetaTag
impl RefUnwindSafe for MetaTag
impl Send for MetaTag
impl Sync for MetaTag
impl Unpin for MetaTag
impl UnsafeUnpin for MetaTag
impl UnwindSafe for MetaTag
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.