pub trait FieldAccess: Sized + Send + 'static {
type Field: Field;
type Path: Path;
// Provided methods
fn equals<'rhs, Rhs: 'rhs, Any>(
self,
rhs: Rhs
) -> <<Self::Field as Field>::Type as FieldEq<'rhs, Rhs, Any>>::EqCond<Self>
where <Self::Field as Field>::Type: FieldEq<'rhs, Rhs, Any> { ... }
fn not_equals<'rhs, Rhs: 'rhs, Any>(
self,
rhs: Rhs
) -> <<Self::Field as Field>::Type as FieldEq<'rhs, Rhs, Any>>::NeCond<Self>
where <Self::Field as Field>::Type: FieldEq<'rhs, Rhs, Any> { ... }
fn less_than<'rhs, Rhs: 'rhs, Any>(
self,
rhs: Rhs
) -> <<Self::Field as Field>::Type as FieldOrd<'rhs, Rhs, Any>>::LtCond<Self>
where <Self::Field as Field>::Type: FieldOrd<'rhs, Rhs, Any> { ... }
fn less_equals<'rhs, Rhs: 'rhs, Any>(
self,
rhs: Rhs
) -> <<Self::Field as Field>::Type as FieldOrd<'rhs, Rhs, Any>>::LeCond<Self>
where <Self::Field as Field>::Type: FieldOrd<'rhs, Rhs, Any> { ... }
fn greater_than<'rhs, Rhs: 'rhs, Any>(
self,
rhs: Rhs
) -> <<Self::Field as Field>::Type as FieldOrd<'rhs, Rhs, Any>>::GtCond<Self>
where <Self::Field as Field>::Type: FieldOrd<'rhs, Rhs, Any> { ... }
fn greater_equals<'rhs, Rhs: 'rhs, Any>(
self,
rhs: Rhs
) -> <<Self::Field as Field>::Type as FieldOrd<'rhs, Rhs, Any>>::GeCond<Self>
where <Self::Field as Field>::Type: FieldOrd<'rhs, Rhs, Any> { ... }
fn like<'rhs, Rhs: 'rhs, Any>(
self,
rhs: Rhs
) -> <<Self::Field as Field>::Type as FieldLike<'rhs, Rhs, Any>>::LiCond<Self>
where <Self::Field as Field>::Type: FieldLike<'rhs, Rhs, Any> { ... }
fn not_like<'rhs, Rhs: 'rhs, Any>(
self,
rhs: Rhs
) -> <<Self::Field as Field>::Type as FieldLike<'rhs, Rhs, Any>>::NlCond<Self>
where <Self::Field as Field>::Type: FieldLike<'rhs, Rhs, Any> { ... }
fn regexp<'rhs, Rhs: 'rhs, Any>(
self,
rhs: Rhs
) -> <<Self::Field as Field>::Type as FieldRegexp<'rhs, Rhs, Any>>::ReCond<Self>
where <Self::Field as Field>::Type: FieldRegexp<'rhs, Rhs, Any> { ... }
fn not_regexp<'rhs, Rhs: 'rhs, Any>(
self,
rhs: Rhs
) -> <<Self::Field as Field>::Type as FieldRegexp<'rhs, Rhs, Any>>::NrCond<Self>
where <Self::Field as Field>::Type: FieldRegexp<'rhs, Rhs, Any> { ... }
}
Expand description
Trait only implemented by FieldProxy
to reduce the amount of generics when using them.
Why
// function using FieldProxy
fn do_something<F, P>(proxy: FieldProxy<F, P>) {/* ... */}
// but in order to do useful things with the proxy, you will need bounds:
fn do_useful<F: Field, P: Path>(proxy: FieldProxy<F, P>) {/* ... */}
// function using FieldAccess
fn do_something_else<A: FieldAccess>(proxy: A) {/* ... */}
// the above already covers the useful part, but depending on your usage you could also use the `impl` sugar:
fn do_sugared(proxy: impl FieldAccess) {/* ... */}
Comparison operations
This trait also adds methods for comparing fields which just wrap their underlying comparison traits.
use rorm::Model;
use rorm::internal::field::access::FieldAccess;
#[derive(Model)]
struct User {
#[rorm(id)]
id: i64,
#[rorm(max_length = 255)]
name: String,
}
// Uses the `FieldEq` impl of `String`
let condition = User::F.name.equals("Bob".to_string());
Required Associated Types§
Provided Methods§
sourcefn equals<'rhs, Rhs: 'rhs, Any>(
self,
rhs: Rhs
) -> <<Self::Field as Field>::Type as FieldEq<'rhs, Rhs, Any>>::EqCond<Self>
fn equals<'rhs, Rhs: 'rhs, Any>( self, rhs: Rhs ) -> <<Self::Field as Field>::Type as FieldEq<'rhs, Rhs, Any>>::EqCond<Self>
Compare the field to another value using ==
sourcefn not_equals<'rhs, Rhs: 'rhs, Any>(
self,
rhs: Rhs
) -> <<Self::Field as Field>::Type as FieldEq<'rhs, Rhs, Any>>::NeCond<Self>
fn not_equals<'rhs, Rhs: 'rhs, Any>( self, rhs: Rhs ) -> <<Self::Field as Field>::Type as FieldEq<'rhs, Rhs, Any>>::NeCond<Self>
Compare the field to another value using !=
sourcefn less_than<'rhs, Rhs: 'rhs, Any>(
self,
rhs: Rhs
) -> <<Self::Field as Field>::Type as FieldOrd<'rhs, Rhs, Any>>::LtCond<Self>
fn less_than<'rhs, Rhs: 'rhs, Any>( self, rhs: Rhs ) -> <<Self::Field as Field>::Type as FieldOrd<'rhs, Rhs, Any>>::LtCond<Self>
Compare the field to another value using <
sourcefn less_equals<'rhs, Rhs: 'rhs, Any>(
self,
rhs: Rhs
) -> <<Self::Field as Field>::Type as FieldOrd<'rhs, Rhs, Any>>::LeCond<Self>
fn less_equals<'rhs, Rhs: 'rhs, Any>( self, rhs: Rhs ) -> <<Self::Field as Field>::Type as FieldOrd<'rhs, Rhs, Any>>::LeCond<Self>
Compare the field to another value using <=
sourcefn greater_than<'rhs, Rhs: 'rhs, Any>(
self,
rhs: Rhs
) -> <<Self::Field as Field>::Type as FieldOrd<'rhs, Rhs, Any>>::GtCond<Self>
fn greater_than<'rhs, Rhs: 'rhs, Any>( self, rhs: Rhs ) -> <<Self::Field as Field>::Type as FieldOrd<'rhs, Rhs, Any>>::GtCond<Self>
Compare the field to another value using <
sourcefn greater_equals<'rhs, Rhs: 'rhs, Any>(
self,
rhs: Rhs
) -> <<Self::Field as Field>::Type as FieldOrd<'rhs, Rhs, Any>>::GeCond<Self>
fn greater_equals<'rhs, Rhs: 'rhs, Any>( self, rhs: Rhs ) -> <<Self::Field as Field>::Type as FieldOrd<'rhs, Rhs, Any>>::GeCond<Self>
Compare the field to another value using >=
sourcefn like<'rhs, Rhs: 'rhs, Any>(
self,
rhs: Rhs
) -> <<Self::Field as Field>::Type as FieldLike<'rhs, Rhs, Any>>::LiCond<Self>
fn like<'rhs, Rhs: 'rhs, Any>( self, rhs: Rhs ) -> <<Self::Field as Field>::Type as FieldLike<'rhs, Rhs, Any>>::LiCond<Self>
Compare the field to another value using LIKE
sourcefn not_like<'rhs, Rhs: 'rhs, Any>(
self,
rhs: Rhs
) -> <<Self::Field as Field>::Type as FieldLike<'rhs, Rhs, Any>>::NlCond<Self>
fn not_like<'rhs, Rhs: 'rhs, Any>( self, rhs: Rhs ) -> <<Self::Field as Field>::Type as FieldLike<'rhs, Rhs, Any>>::NlCond<Self>
Compare the field to another value using NOT LIKE
sourcefn regexp<'rhs, Rhs: 'rhs, Any>(
self,
rhs: Rhs
) -> <<Self::Field as Field>::Type as FieldRegexp<'rhs, Rhs, Any>>::ReCond<Self>
fn regexp<'rhs, Rhs: 'rhs, Any>( self, rhs: Rhs ) -> <<Self::Field as Field>::Type as FieldRegexp<'rhs, Rhs, Any>>::ReCond<Self>
Compare the field to another value using >=
sourcefn not_regexp<'rhs, Rhs: 'rhs, Any>(
self,
rhs: Rhs
) -> <<Self::Field as Field>::Type as FieldRegexp<'rhs, Rhs, Any>>::NrCond<Self>
fn not_regexp<'rhs, Rhs: 'rhs, Any>( self, rhs: Rhs ) -> <<Self::Field as Field>::Type as FieldRegexp<'rhs, Rhs, Any>>::NrCond<Self>
Compare the field to another value using >=
Object Safety§
This trait is not object safe.