#[non_exhaustive]pub struct NostrParserOptions {
pub parse_nostr_uris: bool,
pub parse_urls: bool,
pub parse_hashtags: bool,
pub emit_line_breaks: bool,
}Expand description
Knobs that control which affordances NostrParser recognises.
Disabled affordances are treated as plain text — the parser still makes forward progress and never errors.
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.parse_nostr_uris: boolRecognise nostr:<bech32> URIs.
parse_urls: boolRecognise scheme URLs (http://, https://, ftp://, …).
Recognise #hashtags per NIP-12.
emit_line_breaks: boolEmit dedicated Token::LineBreak for \n bytes; when
false, line breaks are folded into the surrounding
Token::Text runs.
Implementations§
Source§impl NostrParserOptions
impl NostrParserOptions
Sourcepub const fn all_enabled() -> Self
pub const fn all_enabled() -> Self
Every affordance enabled (the most common configuration).
Sourcepub const fn all_disabled() -> Self
pub const fn all_disabled() -> Self
No affordance enabled — the parser yields one
Token::Text covering the whole input.
Sourcepub const fn nostr_uris(self, enabled: bool) -> Self
pub const fn nostr_uris(self, enabled: bool) -> Self
Builder helper toggling Self::parse_nostr_uris.
Sourcepub const fn urls(self, enabled: bool) -> Self
pub const fn urls(self, enabled: bool) -> Self
Builder helper toggling Self::parse_urls.
Builder helper toggling Self::parse_hashtags.
Sourcepub const fn line_breaks(self, enabled: bool) -> Self
pub const fn line_breaks(self, enabled: bool) -> Self
Builder helper toggling Self::emit_line_breaks.
Trait Implementations§
Source§impl Clone for NostrParserOptions
impl Clone for NostrParserOptions
Source§fn clone(&self) -> NostrParserOptions
fn clone(&self) -> NostrParserOptions
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 moreimpl Copy for NostrParserOptions
Source§impl Debug for NostrParserOptions
impl Debug for NostrParserOptions
Source§impl Default for NostrParserOptions
impl Default for NostrParserOptions
impl Eq for NostrParserOptions
Source§impl PartialEq for NostrParserOptions
impl PartialEq for NostrParserOptions
impl StructuralPartialEq for NostrParserOptions
Auto Trait Implementations§
impl Freeze for NostrParserOptions
impl RefUnwindSafe for NostrParserOptions
impl Send for NostrParserOptions
impl Sync for NostrParserOptions
impl Unpin for NostrParserOptions
impl UnsafeUnpin for NostrParserOptions
impl UnwindSafe for NostrParserOptions
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.