From 833343757acc39042829b865ae0123f8bf916a11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20S=C3=A1nchez=20Mu=C3=B1oz?= Date: Tue, 13 Aug 2024 13:30:19 +0200 Subject: [PATCH] Make `StrInput` type publicly visible For cases where you might need to, e.g, define a function with a `Parser>` as argument --- parser/src/input/str.rs | 2 ++ parser/src/lib.rs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/parser/src/input/str.rs b/parser/src/input/str.rs index e44dcee..817b403 100644 --- a/parser/src/input/str.rs +++ b/parser/src/input/str.rs @@ -5,6 +5,7 @@ use crate::{ input::{Input, SkipTabs}, }; +/// A parser input that uses a `&str` as source. #[allow(clippy::module_name_repetitions)] pub struct StrInput<'a> { /// The input str buffer. @@ -18,6 +19,7 @@ pub struct StrInput<'a> { impl<'a> StrInput<'a> { /// Create a new [`StrInput`] with the given str. + #[must_use] pub fn new(input: &'a str) -> Self { Self { buffer: input, diff --git a/parser/src/lib.rs b/parser/src/lib.rs index 9006276..ae81d45 100644 --- a/parser/src/lib.rs +++ b/parser/src/lib.rs @@ -39,6 +39,6 @@ mod input; mod parser; mod scanner; -pub use crate::input::{BufferedInput, Input}; +pub use crate::input::{str::StrInput, BufferedInput, Input}; pub use crate::parser::{Event, EventReceiver, Parser, SpannedEventReceiver, Tag}; pub use crate::scanner::{Marker, ScanError, Span, TScalarStyle};