pub struct RestSql(/* private fields */);Implementations§
Source§impl RestSql
impl RestSql
pub fn new(query: &str) -> Result<Self, RestSqlError>
pub fn new_for_fields( query: &str, allowed: &[&str], ) -> Result<Self, RestSqlError>
Sourcepub fn map_fields(&self, mapper: &impl FieldMapper) -> Self
pub fn map_fields(&self, mapper: &impl FieldMapper) -> Self
Returns a new RestSql with all field names transformed by mapper.
Sourcepub fn from_ast(ast: Ast) -> Result<Self, RestSqlError>
pub fn from_ast(ast: Ast) -> Result<Self, RestSqlError>
Builds a RestSql from a programmatically-constructed AST.
Runs the same validation as new (operator/value compatibility, list
arity for Between, etc.). Field allowlisting is skipped — call
from_ast_for_fields or from_ast_for::<T>() if you need it.
Sourcepub fn from_ast_for_fields(
ast: Ast,
allowed: &[&str],
) -> Result<Self, RestSqlError>
pub fn from_ast_for_fields( ast: Ast, allowed: &[&str], ) -> Result<Self, RestSqlError>
Like from_ast, but also enforces a field allowlist.
Any field in the AST that is not in allowed causes a ValidationError.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RestSql
impl RefUnwindSafe for RestSql
impl Send for RestSql
impl Sync for RestSql
impl Unpin for RestSql
impl UnsafeUnpin for RestSql
impl UnwindSafe for RestSql
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