Skip to main content

Query

Struct Query 

Source
pub struct Query { /* private fields */ }
Expand description

One query: a Method, the attribute it applies to, its values, and the alias a join or an aggregate is exposed under.

Values are PHP values (Value); nested queries (the children of and, or, having, the conditions of a join) are values too.

PHP: Utopia\Query\Query.

use utopia_query::{Method, Query};

let query = Query::equal("status", ["active", "pending"]);
assert_eq!(query.method(), Method::Equal);
assert_eq!(query.to_string()?, r#"{"method":"equal","attribute":"status","values":["active","pending"]}"#);
use Utopia\Query\Query;

$query = Query::equal('status', ['active', 'pending']);
echo $query->getMethod()->value, "\n"; // equal
echo $query->toString(), "\n";         // {"method":"equal","attribute":"status","values":["active","pending"]}

Implementations§

Source§

impl Query

Source

pub fn new( method: Method, attribute: impl Into<String>, values: Array, alias: impl Into<String>, ) -> Self

A query of method on attribute with values and alias.

PHP: new Query($method, $attribute, $values, $alias).

Source

pub fn method(&self) -> Method

What the query does.

PHP: getMethod().

Source

pub fn attribute(&self) -> &str

The attribute (for a join: the joined collection; for raw: the SQL).

PHP: getAttribute().

Source

pub fn values(&self) -> &Array

The values.

PHP: getValues().

Source

pub fn value(&self) -> Option<&Value>

The first value (values[0]), if any.

PHP: getValue($default) is value().unwrap_or(default).

Source

pub fn alias(&self) -> &str

The name a join or an aggregate is exposed under, or "".

PHP: getAlias().

Source

pub fn is_alias_defaulted(&self) -> bool

Whether a join is read under the name of the collection it joins, as a join given no alias is. Decided when the query is built, so it holds after the collection is renamed.

PHP: isAliasDefaulted().

Source

pub fn on_array(&self) -> bool

Whether the attribute holds arrays (set by the database layer).

PHP: onArray().

Source

pub fn attribute_type(&self) -> &str

The attribute’s type (set by the database layer), or "".

PHP: getAttributeType().

Source

pub fn set_method(&mut self, method: Method) -> &mut Self

Sets the method.

PHP: setMethod().

Source

pub fn set_attribute(&mut self, attribute: impl Into<String>) -> &mut Self

Sets the attribute.

PHP: setAttribute().

Source

pub fn set_values(&mut self, values: Array) -> &mut Self

Replaces the values.

PHP: setValues().

Source

pub fn set_value(&mut self, value: Value) -> &mut Self

Replaces the values with one value.

PHP: setValue().

Source

pub fn set_on_array(&mut self, on_array: bool)

Sets whether the attribute holds arrays.

PHP: setOnArray().

Source

pub fn set_attribute_type(&mut self, attribute_type: impl Into<String>)

Sets the attribute’s type.

PHP: setAttributeType().

Source

pub fn is_nested_join(&self) -> bool

Whether this is a join whose values hold ON conditions.

PHP: isNestedJoin().

Source

pub fn join_on_queries(&self) -> Vec<&Query>

The ON conditions of a join (empty for other queries).

PHP: getJoinOnQueries().

Source

pub fn nested(&self) -> impl Iterator<Item = &Query>

The queries among the values, in order.

Source

pub fn is_method(value: &str) -> bool

Whether value is the name of a method.

PHP: Query::isMethod().

Source

pub fn is_spatial_query(&self) -> bool

Whether the method is spatial.

PHP: isSpatialQuery().

Source

pub fn is_nested(&self) -> bool

Whether the method holds other queries.

PHP: isNested().

Source

pub fn parse(query: &str, allow_raw: bool) -> Result<Query>

Parses a query from JSON. Raw queries are refused unless allow_raw: they bypass bindings, so JSON from an untrusted source must not carry them.

PHP: Query::parse($query, $allowRaw).

use utopia_query::{Method, Query};

let query = Query::parse(r#"{"method":"greaterThan","attribute":"age","values":[18]}"#, false)?;
assert_eq!(query.method(), Method::GreaterThan);
assert!(Query::parse(r#"{"method":"raw","attribute":"1 = 1"}"#, false).is_err());
use Utopia\Query\Query;

$query = Query::parse('{"method":"greaterThan","attribute":"age","values":[18]}');
echo $query->getMethod()->value, "\n"; // greaterThan
Source

pub fn parse_bytes(query: &[u8], allow_raw: bool) -> Result<Query>

Query::parse on bytes (PHP strings need not be UTF-8).

Source

pub fn parse_query(query: &Array, allow_raw: bool) -> Result<Query>

Parses a query from its decoded array form (method, attribute, values, alias). Raw queries are refused unless allow_raw.

PHP: Query::parseQuery($query, $allowRaw).

Source

pub fn parse_queries<S: AsRef<str>>( queries: &[S], allow_raw: bool, ) -> Result<Vec<Query>>

Parses each query of queries (see Query::parse).

PHP: Query::parseQueries().

Source

pub fn fingerprint(queries: &[QueryOrJson<'_>]) -> Result<String>

A fingerprint of the queries’ shape: methods and attributes, without values, independent of order, as an MD5 hex digest. Two lists that differ only in values have the same fingerprint (useful to group slow queries).

PHP: Query::fingerprint().

use utopia_query::{Query, QueryOrJson};

let a = Query::equal("status", ["active"]);
let b = Query::equal("status", ["archived"]);
assert_eq!(Query::fingerprint(&[QueryOrJson::Query(&a)])?, Query::fingerprint(&[QueryOrJson::Query(&b)])?);
use Utopia\Query\Query;

var_dump(Query::fingerprint([Query::equal('status', ['active'])]) === Query::fingerprint([Query::equal('status', ['archived'])])); // bool(true)
Source

pub fn shape(&self) -> String

The shape of this query, without values: method:attribute, and for and, or, elemMatch and joins with conditions method:attribute(child|child) with the children’s shapes sorted.

PHP: shape().

Source

pub fn to_array(&self) -> Array

The query as an array: method, attribute (unless empty), alias (unless empty) and values, nested queries as arrays.

PHP: toArray().

Source

pub fn to_string(&self) -> Result<String>

The query as JSON.

PHP: toString().

Source

pub fn compile(&self, compiler: &mut dyn Compiler) -> Result<String>

Compiles this query with compiler, by kind.

PHP: compile(Compiler $compiler).

Source

pub fn equal(attribute: impl Into<String>, values: impl IntoValues) -> Self

equal: the attribute is one of values.

PHP: Query::equal().

Source

pub fn not_equal(attribute: impl Into<String>, value: impl IntoValue) -> Self

notEqual: the attribute is not value; a list means none of its items (an associative array is one value).

PHP: Query::notEqual().

Source

pub fn less_than(attribute: impl Into<String>, value: impl IntoValue) -> Self

lessThan.

PHP: Query::lessThan().

Source

pub fn less_than_equal( attribute: impl Into<String>, value: impl IntoValue, ) -> Self

lessThanEqual.

PHP: Query::lessThanEqual().

Source

pub fn greater_than(attribute: impl Into<String>, value: impl IntoValue) -> Self

greaterThan.

PHP: Query::greaterThan().

Source

pub fn greater_than_equal( attribute: impl Into<String>, value: impl IntoValue, ) -> Self

greaterThanEqual.

PHP: Query::greaterThanEqual().

Source

pub fn contains(attribute: impl Into<String>, values: impl IntoValues) -> Self

contains: a substring of a string attribute, or an element of an array attribute.

PHP: Query::contains() (deprecated: prefer Query::contains_string or Query::contains_any).

Source

pub fn contains_string( attribute: impl Into<String>, values: impl IntoValues, ) -> Self

contains on a string attribute: LIKE '%value%' for each value.

PHP: Query::containsString().

Source

pub fn contains_any( attribute: impl Into<String>, values: impl IntoValues, ) -> Self

containsAny: an array attribute holds any of the values.

PHP: Query::containsAny().

Source

pub fn not_contains( attribute: impl Into<String>, values: impl IntoValues, ) -> Self

notContains.

PHP: Query::notContains().

Source

pub fn between( attribute: impl Into<String>, start: impl IntoValue, end: impl IntoValue, ) -> Self

between (inclusive).

PHP: Query::between().

Source

pub fn not_between( attribute: impl Into<String>, start: impl IntoValue, end: impl IntoValue, ) -> Self

notBetween.

PHP: Query::notBetween().

Source

pub fn search(attribute: impl Into<String>, value: impl IntoValue) -> Self

search: full-text search.

PHP: Query::search().

notSearch.

PHP: Query::notSearch().

Source

pub fn select<S: Into<String>>(attributes: impl IntoIterator<Item = S>) -> Self

select: the attributes to return.

PHP: Query::select().

Source

pub fn select_values(values: Array) -> Self

select with any values (PHP accepts an array of anything).

Source

pub fn order_desc( attribute: impl Into<String>, nulls: Option<NullsPosition>, ) -> Self

orderDesc, with where NULLs sort.

PHP: Query::orderDesc().

Source

pub fn order_asc( attribute: impl Into<String>, nulls: Option<NullsPosition>, ) -> Self

orderAsc, with where NULLs sort.

PHP: Query::orderAsc().

Source

pub fn order_random() -> Self

orderRandom.

PHP: Query::orderRandom().

Source

pub fn limit(value: i64) -> Self

limit.

PHP: Query::limit().

Source

pub fn offset(value: i64) -> Self

offset.

PHP: Query::offset().

Source

pub fn cursor_after(row: Value) -> Self

cursorAfter: page after a row (an array of its columns, a stdClass, or a Object::Row).

PHP: Query::cursorAfter().

Source

pub fn cursor_before(row: Value) -> Self

cursorBefore: page before a row.

PHP: Query::cursorBefore().

Source

pub fn is_null(attribute: impl Into<String>) -> Self

isNull.

PHP: Query::isNull().

Source

pub fn is_not_null(attribute: impl Into<String>) -> Self

isNotNull.

PHP: Query::isNotNull().

Source

pub fn starts_with(attribute: impl Into<String>, value: impl IntoValue) -> Self

startsWith.

PHP: Query::startsWith().

Source

pub fn not_starts_with( attribute: impl Into<String>, value: impl IntoValue, ) -> Self

notStartsWith.

PHP: Query::notStartsWith().

Source

pub fn ends_with(attribute: impl Into<String>, value: impl IntoValue) -> Self

endsWith.

PHP: Query::endsWith().

Source

pub fn not_ends_with( attribute: impl Into<String>, value: impl IntoValue, ) -> Self

notEndsWith.

PHP: Query::notEndsWith().

Source

pub fn created_before(value: impl IntoValue) -> Self

Documents created before a date: lessThan('$createdAt', value).

PHP: Query::createdBefore().

Source

pub fn created_after(value: impl IntoValue) -> Self

Documents created after a date.

PHP: Query::createdAfter().

Source

pub fn updated_before(value: impl IntoValue) -> Self

Documents updated before a date.

PHP: Query::updatedBefore().

Source

pub fn updated_after(value: impl IntoValue) -> Self

Documents updated after a date.

PHP: Query::updatedAfter().

Source

pub fn created_between(start: impl IntoValue, end: impl IntoValue) -> Self

Documents created between two dates.

PHP: Query::createdBetween().

Source

pub fn updated_between(start: impl IntoValue, end: impl IntoValue) -> Self

Documents updated between two dates.

PHP: Query::updatedBetween().

Source

pub fn or(queries: impl IntoIterator<Item = Query>) -> Self

or of queries.

PHP: Query::or().

Source

pub fn and(queries: impl IntoIterator<Item = Query>) -> Self

and of queries.

PHP: Query::and().

Source

pub fn logical(method: Method, values: Array) -> Self

A logical query of any values (PHP accepts an array of anything).

Source

pub fn contains_all( attribute: impl Into<String>, values: impl IntoValues, ) -> Self

containsAll: an array attribute holds every value.

PHP: Query::containsAll().

Source

pub fn by_type<'a>(queries: &'a [Query], methods: &[Method]) -> Vec<&'a Query>

The queries of the given methods.

PHP: Query::getByType() (the clone flag is moot: these are references).

Source

pub fn cursor_queries(queries: &[Query]) -> Vec<&Query>

The cursor queries.

PHP: Query::getCursorQueries().

Source

pub fn group_by_type(queries: &[Query]) -> ParsedQuery

Groups queries by what they do (see ParsedQuery).

PHP: Query::groupByType().

Source

pub fn distance_equal( attribute: impl Into<String>, values: Array, distance: impl IntoValue, meters: bool, ) -> Self

distanceEqual: the distance from values (a point or a geometry) equals distance (in meters when meters).

PHP: Query::distanceEqual().

Source

pub fn distance_not_equal( attribute: impl Into<String>, values: Array, distance: impl IntoValue, meters: bool, ) -> Self

distanceNotEqual.

PHP: Query::distanceNotEqual().

Source

pub fn distance_greater_than( attribute: impl Into<String>, values: Array, distance: impl IntoValue, meters: bool, ) -> Self

distanceGreaterThan.

PHP: Query::distanceGreaterThan().

Source

pub fn distance_less_than( attribute: impl Into<String>, values: Array, distance: impl IntoValue, meters: bool, ) -> Self

distanceLessThan.

PHP: Query::distanceLessThan().

Source

pub fn intersects(attribute: impl Into<String>, values: Array) -> Self

intersects (spatial).

PHP: Query::intersects().

Source

pub fn not_intersects(attribute: impl Into<String>, values: Array) -> Self

notIntersects (spatial).

PHP: Query::notIntersects().

Source

pub fn crosses(attribute: impl Into<String>, values: Array) -> Self

crosses (spatial).

PHP: Query::crosses().

Source

pub fn not_crosses(attribute: impl Into<String>, values: Array) -> Self

notCrosses (spatial).

PHP: Query::notCrosses().

Source

pub fn overlaps(attribute: impl Into<String>, values: Array) -> Self

overlaps (spatial).

PHP: Query::overlaps().

Source

pub fn not_overlaps(attribute: impl Into<String>, values: Array) -> Self

notOverlaps (spatial).

PHP: Query::notOverlaps().

Source

pub fn touches(attribute: impl Into<String>, values: Array) -> Self

touches (spatial).

PHP: Query::touches().

Source

pub fn not_touches(attribute: impl Into<String>, values: Array) -> Self

notTouches (spatial).

PHP: Query::notTouches().

Source

pub fn vector_dot(attribute: impl Into<String>, vector: Array) -> Self

vectorDot: similarity to vector by dot product.

PHP: Query::vectorDot().

Source

pub fn vector_cosine(attribute: impl Into<String>, vector: Array) -> Self

vectorCosine.

PHP: Query::vectorCosine().

Source

pub fn vector_euclidean(attribute: impl Into<String>, vector: Array) -> Self

vectorEuclidean.

PHP: Query::vectorEuclidean().

Source

pub fn regex(attribute: impl Into<String>, pattern: impl IntoValue) -> Self

regex.

PHP: Query::regex().

Source

pub fn exists(attributes: Array) -> Self

exists: the attributes are present.

PHP: Query::exists().

Source

pub fn not_exists(attribute: impl IntoValue) -> Self

notExists: the attribute (or each of a list) is absent.

PHP: Query::notExists().

Source

pub fn elem_match( attribute: impl Into<String>, queries: impl IntoIterator<Item = Query>, ) -> Self

elemMatch: an element of the array attribute matches every query.

PHP: Query::elemMatch().

Source

pub fn relationship( attribute: impl Into<String>, queries: impl IntoIterator<Item = Query>, ) -> Self

relationship: queries, written against the related collection, that shape the documents populated for the relationship attribute. It is nested, and validate() skips it: its queries name another collection’s attributes.

use utopia_query::{Method, Query};

let query = Query::relationship("books", [Query::limit(2)]);
assert_eq!(query.method(), Method::Relationship);
assert!(Method::Relationship.is_nested());
assert_eq!(query.shape(), "relationship:books(limit:)");
assert!(Query::validate(&[query], &["title"]).unwrap().is_empty());

PHP: Query::relationship().

Source

pub fn count(attribute: impl Into<String>, alias: impl Into<String>) -> Self

count (* counts rows).

PHP: Query::count().

Source

pub fn count_distinct( attribute: impl Into<String>, alias: impl Into<String>, ) -> Self

countDistinct.

PHP: Query::countDistinct().

Source

pub fn sum(attribute: impl Into<String>, alias: impl Into<String>) -> Self

sum.

PHP: Query::sum().

Source

pub fn avg(attribute: impl Into<String>, alias: impl Into<String>) -> Self

avg.

PHP: Query::avg().

Source

pub fn min(attribute: impl Into<String>, alias: impl Into<String>) -> Self

min.

PHP: Query::min().

Source

pub fn max(attribute: impl Into<String>, alias: impl Into<String>) -> Self

max.

PHP: Query::max().

Source

pub fn stddev(attribute: impl Into<String>, alias: impl Into<String>) -> Self

stddev.

PHP: Query::stddev().

Source

pub fn stddev_pop( attribute: impl Into<String>, alias: impl Into<String>, ) -> Self

stddevPop.

PHP: Query::stddevPop().

Source

pub fn stddev_samp( attribute: impl Into<String>, alias: impl Into<String>, ) -> Self

stddevSamp.

PHP: Query::stddevSamp().

Source

pub fn variance(attribute: impl Into<String>, alias: impl Into<String>) -> Self

variance.

PHP: Query::variance().

Source

pub fn var_pop(attribute: impl Into<String>, alias: impl Into<String>) -> Self

varPop.

PHP: Query::varPop().

Source

pub fn var_samp(attribute: impl Into<String>, alias: impl Into<String>) -> Self

varSamp.

PHP: Query::varSamp().

Source

pub fn bit_and(attribute: impl Into<String>, alias: impl Into<String>) -> Self

bitAnd.

PHP: Query::bitAnd().

Source

pub fn bit_or(attribute: impl Into<String>, alias: impl Into<String>) -> Self

bitOr.

PHP: Query::bitOr().

Source

pub fn bit_xor(attribute: impl Into<String>, alias: impl Into<String>) -> Self

bitXor.

PHP: Query::bitXor().

Source

pub fn group_by<S: Into<String>>( attributes: impl IntoIterator<Item = S>, ) -> Self

groupBy.

PHP: Query::groupBy().

Source

pub fn group_by_time_bucket( attribute: impl Into<String>, interval: &str, ) -> Result<Self>

groupByTimeBucket: groups by attribute cut into windows of interval (one of GROUP_BY_TIME_BUCKET_INTERVALS).

PHP: Query::groupByTimeBucket().

Source

pub fn having(queries: impl IntoIterator<Item = Query>) -> Self

having: conditions on aggregates.

PHP: Query::having().

Source

pub fn distinct() -> Self

distinct.

PHP: Query::distinct().

Source

pub fn on( left: impl Into<String>, right: impl Into<String>, operator: impl Into<String>, ) -> Self

on: a column-to-column join condition (operator defaults to = in PHP).

PHP: Query::on().

Source

pub fn join( collection: impl Into<String>, alias: impl Into<String>, on: Vec<Query>, ) -> Result<Self>

An inner join of collection as alias on conditions (on queries and filters).

PHP: Query::join().

Source

pub fn left_join( collection: impl Into<String>, alias: impl Into<String>, on: Vec<Query>, ) -> Result<Self>

A left join.

PHP: Query::leftJoin().

Source

pub fn right_join( collection: impl Into<String>, alias: impl Into<String>, on: Vec<Query>, ) -> Result<Self>

A right join.

PHP: Query::rightJoin().

Source

pub fn full_outer_join( collection: impl Into<String>, alias: impl Into<String>, on: Vec<Query>, ) -> Result<Self>

A full outer join.

PHP: Query::fullOuterJoin().

Source

pub fn cross_join( collection: impl Into<String>, alias: impl Into<String>, ) -> Result<Self>

A cross join (no conditions).

PHP: Query::crossJoin().

Source

pub fn natural_join( collection: impl Into<String>, alias: impl Into<String>, ) -> Result<Self>

A natural join (no conditions).

PHP: Query::naturalJoin().

Source

pub fn join_values( method: Method, collection: impl Into<String>, alias: impl Into<String>, on: Array, ) -> Result<Self>

A join of any conditions (values that must all be queries, as PHP checks).

Source

pub fn union(queries: impl IntoIterator<Item = Query>) -> Self

union of queries.

PHP: Query::union().

Source

pub fn union_all(queries: impl IntoIterator<Item = Query>) -> Self

unionAll of queries.

PHP: Query::unionAll().

Source

pub fn json_contains( attribute: impl Into<String>, value: impl IntoValue, ) -> Self

jsonContains: a JSON attribute contains value.

PHP: Query::jsonContains().

Source

pub fn json_not_contains( attribute: impl Into<String>, value: impl IntoValue, ) -> Self

jsonNotContains.

PHP: Query::jsonNotContains().

Source

pub fn json_overlaps(attribute: impl Into<String>, values: Array) -> Self

jsonOverlaps: a JSON array attribute shares an element with values.

PHP: Query::jsonOverlaps().

Source

pub fn json_path( attribute: impl Into<String>, path: impl Into<String>, operator: impl Into<String>, value: impl IntoValue, ) -> Self

jsonPath: the value at path compares to value with operator.

PHP: Query::jsonPath().

Source

pub fn covers(attribute: impl Into<String>, values: Array) -> Self

covers (spatial).

PHP: Query::covers().

Source

pub fn not_covers(attribute: impl Into<String>, values: Array) -> Self

notCovers (spatial).

PHP: Query::notCovers().

Source

pub fn spatial_equals(attribute: impl Into<String>, values: Array) -> Self

spatialEquals (spatial).

PHP: Query::spatialEquals().

Source

pub fn not_spatial_equals(attribute: impl Into<String>, values: Array) -> Self

notSpatialEquals (spatial).

PHP: Query::notSpatialEquals().

Source

pub fn raw(sql: impl Into<String>, bindings: Array) -> Self

raw: SQL used as given, with its bindings.

PHP: Query::raw().

Source

pub fn page(page: i64, per_page: i64) -> Result<[Query; 2]>

The limit and offset of page page (from 1) of per_page rows.

PHP: Query::page().

Source

pub fn merge(a: &[Query], b: &[Query]) -> Vec<Query>

a followed by b, where a limit, offset or cursor in b replaces any of the same method in a.

PHP: Query::merge().

Source

pub fn diff(a: &[Query], b: &[Query]) -> Vec<Query>

The queries of a not in b (compared by their array form).

PHP: Query::diff().

Source

pub fn validate<S: AsRef<str>>( queries: &[Query], allowed: &[S], ) -> Result<Vec<String>>

Error messages for attributes outside allowed (nested queries included; pagination, selections and existence checks skipped). Fails as PHP does when a groupBy column is an object it cannot print.

PHP: Query::validate().

Trait Implementations§

Source§

impl Clone for Query

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Query

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<Query> for Value

Source§

fn from(query: Query) -> Self

A nested query.

Source§

impl IntoValue for Query

Source§

fn into_value(self) -> Value

The value.
Source§

impl PartialEq for Query

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Query

Auto Trait Implementations§

§

impl Forget for Query

§

impl Freeze for Query
where *const u8 is !null: Freeze, PhantomData<u8>: Freeze, *const ArcInner<Repr<Object>> is !null: Freeze, PhantomData<ArcInner<Repr<Object>>>: Freeze,

§

impl Move for Query

§

impl RefUnwindSafe for Query

§

impl Send for Query
where RawVecInner: Send, Arc<Repr<Object>>: Send,

§

impl Sync for Query
where RawVecInner: Sync, Arc<Repr<Object>>: Sync,

§

impl Unpin for Query
where *const u8 is !null: Unpin, Arc<Repr<Object>>: Unpin,

§

impl UnsafeUnpin for Query
where *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, *const ArcInner<Repr<Object>> is !null: UnsafeUnpin, PhantomData<ArcInner<Repr<Object>>>: UnsafeUnpin,

§

impl UnwindSafe for Query
where RawVecInner: UnwindSafe, Arc<Repr<Object>>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.