Filter by mime
Some checks failed
CI / Typos (push) Successful in 17s
CI / Build and test (push) Successful in 2m28s
CI / Clippy (push) Failing after 3m59s
CI / Build and test (all features) (push) Successful in 9m40s

This commit is contained in:
2026-03-15 10:20:15 -07:00
parent 32aedb9dc1
commit a2079877fd
30 changed files with 258 additions and 93 deletions

View File

@@ -2,7 +2,10 @@ use pile_config::Label;
use smartstring::{LazyCompact, SmartString};
use std::sync::Arc;
use crate::{extract::traits::ObjectExtractor, value::PileValue};
use crate::{
extract::traits::{ExtractState, ObjectExtractor},
value::PileValue,
};
pub struct StringExtractor {
item: Arc<SmartString<LazyCompact>>,
@@ -18,6 +21,7 @@ impl StringExtractor {
impl ObjectExtractor for StringExtractor {
async fn field(
&self,
_state: &ExtractState,
name: &Label,
args: Option<&str>,
) -> Result<Option<PileValue>, std::io::Error> {
@@ -89,7 +93,10 @@ mod tests {
#[expect(clippy::unwrap_used)]
async fn field(ext: &StringExtractor, name: &str, args: Option<&str>) -> Option<PileValue> {
ext.field(&Label::new(name).unwrap(), args).await.unwrap()
let state = ExtractState { ignore_mime: false };
ext.field(&state, &Label::new(name).unwrap(), args)
.await
.unwrap()
}
fn string(v: Option<PileValue>) -> Option<String> {