pub struct ExportConfig { /* private fields */ }Expand description
Export configuration
§Examples
use reinhardt_admin::core::ExportConfig;
use reinhardt_admin::core::export::ExportFormat;
let config = ExportConfig::new("User", ExportFormat::CSV)
.with_field("id")
.with_field("username")
.with_field("email");
assert_eq!(config.model_name(), "User");
assert_eq!(config.field_count(), 3);Implementations§
Source§impl ExportConfig
impl ExportConfig
Sourcepub fn new(model_name: impl Into<String>, format: ExportFormat) -> Self
pub fn new(model_name: impl Into<String>, format: ExportFormat) -> Self
Create a new export configuration
Sourcepub fn model_name(&self) -> &str
pub fn model_name(&self) -> &str
Get model name
Sourcepub fn format(&self) -> ExportFormat
pub fn format(&self) -> ExportFormat
Get export format
Sourcepub fn with_field(self, field: impl Into<String>) -> Self
pub fn with_field(self, field: impl Into<String>) -> Self
Add a field to export
Sourcepub fn with_fields(self, fields: Vec<String>) -> Self
pub fn with_fields(self, fields: Vec<String>) -> Self
Set fields to export
Sourcepub fn field_count(&self) -> usize
pub fn field_count(&self) -> usize
Get field count
Sourcepub fn with_field_label(
self,
field: impl Into<String>,
label: impl Into<String>,
) -> Self
pub fn with_field_label( self, field: impl Into<String>, label: impl Into<String>, ) -> Self
Set field label
Sourcepub fn get_field_label(&self, field: &str) -> Option<&String>
pub fn get_field_label(&self, field: &str) -> Option<&String>
Get field label
Sourcepub fn with_filter(
self,
field: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_filter( self, field: impl Into<String>, value: impl Into<String>, ) -> Self
Add a filter
Sourcepub fn with_ordering(self, ordering: Vec<String>) -> Self
pub fn with_ordering(self, ordering: Vec<String>) -> Self
Set ordering
Sourcepub fn with_max_rows(self, max: usize) -> Self
pub fn with_max_rows(self, max: usize) -> Self
Set maximum rows
Sourcepub fn with_headers(self, include: bool) -> Self
pub fn with_headers(self, include: bool) -> Self
Set whether to include headers
Sourcepub fn include_headers(&self) -> bool
pub fn include_headers(&self) -> bool
Check if headers should be included
Trait Implementations§
Source§impl Clone for ExportConfig
impl Clone for ExportConfig
Source§fn clone(&self) -> ExportConfig
fn clone(&self) -> ExportConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ExportConfig
impl RefUnwindSafe for ExportConfig
impl Send for ExportConfig
impl Sync for ExportConfig
impl Unpin for ExportConfig
impl UnwindSafe for ExportConfig
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more