Filter by mime
This commit is contained in:
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user