Skip to main content

PublicValue

Enum PublicValue 

Source
pub enum PublicValue {
Show 18 variants None, Null, Bool(bool), Number(Number), String(String), Bytes(Bytes), Duration(Duration), Datetime(Datetime), Uuid(Uuid), Geometry(Geometry), Table(Table), RecordId(RecordId), File(File), Range(Box<Range>), Regex(Regex), Array(Array), Object(Object), Set(Set),
}
Expand description

Represents a value in SurrealDB

This enum contains all possible value types that can be stored in SurrealDB. Each variant corresponds to a different data type supported by the database.

Variants§

§

None

Represents the absence of a value

§

Null

Represents a null value

§

Bool(bool)

A boolean value (true or false)

§

Number(Number)

A numeric value (integer, float, or decimal)

§

String(String)

A string value

§

Bytes(Bytes)

Binary data

§

Duration(Duration)

A duration value representing a time span

§

Datetime(Datetime)

A datetime value representing a point in time

§

Uuid(Uuid)

A UUID value

§

Geometry(Geometry)

A geometric value (point, line, polygon, etc.)

§

Table(Table)

A table value

§

RecordId(RecordId)

A record identifier

§

File(File)

A file reference

§

Range(Box<Range>)

A range of values

§

Regex(Regex)

A regular expression

§

Array(Array)

An array of values

§

Object(Object)

An object containing key-value pairs

§

Set(Set)

A set of values

Implementations§

Source§

impl Value

Source

pub fn is_none(&self) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn is_null(&self) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn is_bool(&self) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn from_bool(value: bool) -> Value

Converts the given value into a Value

Source§

impl Value

Source

pub fn into_bool(self) -> Result<bool, Error>

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn as_bool(&self) -> Option<&bool>

Returns a reference to the inner value if it matches the expected type.

Returns Some(&T) if the value is of the expected type, None otherwise.

Source§

impl Value

Source

pub fn is_true(&self) -> bool

Checks if this value is specifically true

Returns true if the value is Value::Bool(true), false otherwise.

Source

pub fn is_false(&self) -> bool

Checks if this value is specifically false

Returns true if the value is Value::Bool(false), false otherwise.

Source§

impl Value

Source

pub fn is_number(&self) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn from_number(value: Number) -> Value

Converts the given value into a Value

Source§

impl Value

Source

pub fn into_number(self) -> Result<Number, Error>

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn as_number(&self) -> Option<&Number>

Returns a reference to the inner value if it matches the expected type.

Returns Some(&T) if the value is of the expected type, None otherwise.

Source§

impl Value

Source

pub fn is_number_and(&self, callback: impl FnOnce(&Number) -> bool) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn is_int(&self) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn is_i64(&self) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn from_int(value: i64) -> Value

Converts the given value into a Value

Source§

impl Value

Source

pub fn from_i64(value: i64) -> Value

Converts the given value into a Value

Source§

impl Value

Source

pub fn into_int(self) -> Result<i64, Error>

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn into_i64(self) -> Result<i64, Error>

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn as_int(&self) -> Option<&i64>

Returns a reference to the inner value if it matches the expected type.

Returns Some(&T) if the value is of the expected type, None otherwise.

Source

pub fn as_i64(&self) -> Option<&i64>

Returns a reference to the inner value if it matches the expected type.

Returns Some(&T) if the value is of the expected type, None otherwise.

Source§

impl Value

Source

pub fn is_int_and(&self, callback: impl FnOnce(&i64) -> bool) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source

pub fn is_i64_and(&self, callback: impl FnOnce(&i64) -> bool) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn is_float(&self) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn is_f64(&self) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn from_float(value: f64) -> Value

Converts the given value into a Value

Source§

impl Value

Source

pub fn from_f64(value: f64) -> Value

Converts the given value into a Value

Source§

impl Value

Source

pub fn into_float(self) -> Result<f64, Error>

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn into_f64(self) -> Result<f64, Error>

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn as_float(&self) -> Option<&f64>

Returns a reference to the inner value if it matches the expected type.

Returns Some(&T) if the value is of the expected type, None otherwise.

Source

pub fn as_f64(&self) -> Option<&f64>

Returns a reference to the inner value if it matches the expected type.

Returns Some(&T) if the value is of the expected type, None otherwise.

Source§

impl Value

Source

pub fn is_float_and(&self, callback: impl FnOnce(&f64) -> bool) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source

pub fn is_f64_and(&self, callback: impl FnOnce(&f64) -> bool) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn is_decimal(&self) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn from_decimal(value: Decimal) -> Value

Converts the given value into a Value

Source§

impl Value

Source

pub fn into_decimal(self) -> Result<Decimal, Error>

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn as_decimal(&self) -> Option<&Decimal>

Returns a reference to the inner value if it matches the expected type.

Returns Some(&T) if the value is of the expected type, None otherwise.

Source§

impl Value

Source

pub fn is_decimal_and(&self, callback: impl FnOnce(&Decimal) -> bool) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn is_string(&self) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn from_string(value: String) -> Value

Converts the given value into a Value

Source§

impl Value

Source

pub fn into_string(self) -> Result<String, Error>

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn as_string(&self) -> Option<&String>

Returns a reference to the inner value if it matches the expected type.

Returns Some(&T) if the value is of the expected type, None otherwise.

Source§

impl Value

Source

pub fn is_string_and(&self, callback: impl FnOnce(&String) -> bool) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn is_duration(&self) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn from_duration(value: Duration) -> Value

Converts the given value into a Value

Source§

impl Value

Source

pub fn into_duration(self) -> Result<Duration, Error>

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn as_duration(&self) -> Option<&Duration>

Returns a reference to the inner value if it matches the expected type.

Returns Some(&T) if the value is of the expected type, None otherwise.

Source§

impl Value

Source

pub fn is_duration_and(&self, callback: impl FnOnce(&Duration) -> bool) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn is_datetime(&self) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn from_datetime(value: Datetime) -> Value

Converts the given value into a Value

Source§

impl Value

Source

pub fn into_datetime(self) -> Result<Datetime, Error>

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn as_datetime(&self) -> Option<&Datetime>

Returns a reference to the inner value if it matches the expected type.

Returns Some(&T) if the value is of the expected type, None otherwise.

Source§

impl Value

Source

pub fn is_datetime_and(&self, callback: impl FnOnce(&Datetime) -> bool) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn is_uuid(&self) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn from_uuid(value: Uuid) -> Value

Converts the given value into a Value

Source§

impl Value

Source

pub fn into_uuid(self) -> Result<Uuid, Error>

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn as_uuid(&self) -> Option<&Uuid>

Returns a reference to the inner value if it matches the expected type.

Returns Some(&T) if the value is of the expected type, None otherwise.

Source§

impl Value

Source

pub fn is_uuid_and(&self, callback: impl FnOnce(&Uuid) -> bool) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn is_array(&self) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn from_array(value: Array) -> Value

Converts the given value into a Value

Source§

impl Value

Source

pub fn into_array(self) -> Result<Array, Error>

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn as_array(&self) -> Option<&Array>

Returns a reference to the inner value if it matches the expected type.

Returns Some(&T) if the value is of the expected type, None otherwise.

Source§

impl Value

Source

pub fn is_array_and(&self, callback: impl FnOnce(&Array) -> bool) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn is_set(&self) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn from_set(value: Set) -> Value

Converts the given value into a Value

Source§

impl Value

Source

pub fn into_set(self) -> Result<Set, Error>

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn as_set(&self) -> Option<&Set>

Returns a reference to the inner value if it matches the expected type.

Returns Some(&T) if the value is of the expected type, None otherwise.

Source§

impl Value

Source

pub fn is_set_and(&self, callback: impl FnOnce(&Set) -> bool) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn is_object(&self) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn from_object(value: Object) -> Value

Converts the given value into a Value

Source§

impl Value

Source

pub fn into_object(self) -> Result<Object, Error>

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn as_object(&self) -> Option<&Object>

Returns a reference to the inner value if it matches the expected type.

Returns Some(&T) if the value is of the expected type, None otherwise.

Source§

impl Value

Source

pub fn is_object_and(&self, callback: impl FnOnce(&Object) -> bool) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn is_geometry(&self) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn from_geometry(value: Geometry) -> Value

Converts the given value into a Value

Source§

impl Value

Source

pub fn into_geometry(self) -> Result<Geometry, Error>

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn as_geometry(&self) -> Option<&Geometry>

Returns a reference to the inner value if it matches the expected type.

Returns Some(&T) if the value is of the expected type, None otherwise.

Source§

impl Value

Source

pub fn is_geometry_and(&self, callback: impl FnOnce(&Geometry) -> bool) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn is_bytes(&self) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn from_bytes(value: Bytes) -> Value

Converts the given value into a Value

Source§

impl Value

Source

pub fn into_bytes(self) -> Result<Bytes, Error>

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn as_bytes(&self) -> Option<&Bytes>

Returns a reference to the inner value if it matches the expected type.

Returns Some(&T) if the value is of the expected type, None otherwise.

Source§

impl Value

Source

pub fn is_bytes_and(&self, callback: impl FnOnce(&Bytes) -> bool) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn is_table(&self) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn from_table(value: Table) -> Value

Converts the given value into a Value

Source§

impl Value

Source

pub fn into_table(self) -> Result<Table, Error>

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn as_table(&self) -> Option<&Table>

Returns a reference to the inner value if it matches the expected type.

Returns Some(&T) if the value is of the expected type, None otherwise.

Source§

impl Value

Source

pub fn is_table_and(&self, callback: impl FnOnce(&Table) -> bool) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn is_record(&self) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn from_record(value: RecordId) -> Value

Converts the given value into a Value

Source§

impl Value

Source

pub fn into_record(self) -> Result<RecordId, Error>

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn as_record(&self) -> Option<&RecordId>

Returns a reference to the inner value if it matches the expected type.

Returns Some(&T) if the value is of the expected type, None otherwise.

Source§

impl Value

Source

pub fn is_record_and(&self, callback: impl FnOnce(&RecordId) -> bool) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn is_file(&self) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn from_file(value: File) -> Value

Converts the given value into a Value

Source§

impl Value

Source

pub fn into_file(self) -> Result<File, Error>

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn as_file(&self) -> Option<&File>

Returns a reference to the inner value if it matches the expected type.

Returns Some(&T) if the value is of the expected type, None otherwise.

Source§

impl Value

Source

pub fn is_file_and(&self, callback: impl FnOnce(&File) -> bool) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn is_range(&self) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn from_range(value: Range) -> Value

Converts the given value into a Value

Source§

impl Value

Source

pub fn into_range(self) -> Result<Range, Error>

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn as_range(&self) -> Option<&Range>

Returns a reference to the inner value if it matches the expected type.

Returns Some(&T) if the value is of the expected type, None otherwise.

Source§

impl Value

Source

pub fn is_range_and(&self, callback: impl FnOnce(&Range) -> bool) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn is_vec<T>(&self) -> bool
where T: SurrealValue,

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn from_vec<T>(value: Vec<T>) -> Value
where T: SurrealValue,

Converts the given value into a Value

Source§

impl Value

Source

pub fn into_vec<T>(self) -> Result<Vec<T>, Error>
where T: SurrealValue,

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn is_option<T>(&self) -> bool
where T: SurrealValue,

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn from_option<T>(value: Option<T>) -> Value
where T: SurrealValue,

Converts the given value into a Value

Source§

impl Value

Source

pub fn into_option<T>(self) -> Result<Option<T>, Error>
where T: SurrealValue,

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn from_btreemap<V>(value: BTreeMap<String, V>) -> Value
where V: SurrealValue,

Converts the given value into a Value

Source§

impl Value

Source

pub fn into_btreemap<V>(self) -> Result<BTreeMap<String, V>, Error>
where V: SurrealValue,

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn from_hashmap<V>(value: HashMap<String, V>) -> Value
where V: SurrealValue,

Converts the given value into a Value

Source§

impl Value

Source

pub fn into_hashmap<V>(self) -> Result<HashMap<String, V>, Error>
where V: SurrealValue,

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn is_point(&self) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn from_point(value: Point) -> Value

Converts the given value into a Value

Source§

impl Value

Source

pub fn into_point(self) -> Result<Point, Error>

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn as_point(&self) -> Option<&Point>

Returns a reference to the inner value if it matches the expected type.

Returns Some(&T) if the value is of the expected type, None otherwise.

Source§

impl Value

Source

pub fn is_point_and(&self, callback: impl FnOnce(&Point) -> bool) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn is_line(&self) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn from_line(value: LineString) -> Value

Converts the given value into a Value

Source§

impl Value

Source

pub fn into_line(self) -> Result<LineString, Error>

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn as_line(&self) -> Option<&LineString>

Returns a reference to the inner value if it matches the expected type.

Returns Some(&T) if the value is of the expected type, None otherwise.

Source§

impl Value

Source

pub fn is_line_and(&self, callback: impl FnOnce(&LineString) -> bool) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn is_polygon(&self) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn from_polygon(value: Polygon) -> Value

Converts the given value into a Value

Source§

impl Value

Source

pub fn into_polygon(self) -> Result<Polygon, Error>

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn as_polygon(&self) -> Option<&Polygon>

Returns a reference to the inner value if it matches the expected type.

Returns Some(&T) if the value is of the expected type, None otherwise.

Source§

impl Value

Source

pub fn is_polygon_and(&self, callback: impl FnOnce(&Polygon) -> bool) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn is_multipoint(&self) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn from_multipoint(value: MultiPoint) -> Value

Converts the given value into a Value

Source§

impl Value

Source

pub fn into_multipoint(self) -> Result<MultiPoint, Error>

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn as_multipoint(&self) -> Option<&MultiPoint>

Returns a reference to the inner value if it matches the expected type.

Returns Some(&T) if the value is of the expected type, None otherwise.

Source§

impl Value

Source

pub fn is_multipoint_and( &self, callback: impl FnOnce(&MultiPoint) -> bool, ) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn is_multiline(&self) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn from_multiline(value: MultiLineString) -> Value

Converts the given value into a Value

Source§

impl Value

Source

pub fn into_multiline(self) -> Result<MultiLineString, Error>

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn as_multiline(&self) -> Option<&MultiLineString>

Returns a reference to the inner value if it matches the expected type.

Returns Some(&T) if the value is of the expected type, None otherwise.

Source§

impl Value

Source

pub fn is_multiline_and( &self, callback: impl FnOnce(&MultiLineString) -> bool, ) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn is_multipolygon(&self) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn from_multipolygon(value: MultiPolygon) -> Value

Converts the given value into a Value

Source§

impl Value

Source

pub fn into_multipolygon(self) -> Result<MultiPolygon, Error>

Attempts to convert a SurrealDB value into the given type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source§

impl Value

Source

pub fn as_multipolygon(&self) -> Option<&MultiPolygon>

Returns a reference to the inner value if it matches the expected type.

Returns Some(&T) if the value is of the expected type, None otherwise.

Source§

impl Value

Source

pub fn is_multipolygon_and( &self, callback: impl FnOnce(&MultiPolygon) -> bool, ) -> bool

Checks if this value can be converted to the given type

Returns true if the value can be converted to the type, false otherwise.

Source§

impl Value

Source

pub fn is_i8(&self) -> bool

Checks if this value can be converted to the given type

Source

pub fn from_i8(value: i8) -> Value

Converts the given value into a Value

Source

pub fn into_i8(self) -> Result<i8, Error>

Attempts to convert a SurrealDB value into the given type

Source

pub fn is_i8_and(&self, callback: impl FnOnce(&i8) -> bool) -> bool

Checks if this value matches the type and passes the callback check

Source

pub fn as_i8(&self) -> Option<i8>

Returns a reference-like value if it matches the expected type Note: For integer types, this returns None since the value needs conversion

Source§

impl Value

Source

pub fn is_i16(&self) -> bool

Checks if this value can be converted to the given type

Source

pub fn from_i16(value: i16) -> Value

Converts the given value into a Value

Source

pub fn into_i16(self) -> Result<i16, Error>

Attempts to convert a SurrealDB value into the given type

Source

pub fn is_i16_and(&self, callback: impl FnOnce(&i16) -> bool) -> bool

Checks if this value matches the type and passes the callback check

Source

pub fn as_i16(&self) -> Option<i16>

Returns a reference-like value if it matches the expected type Note: For integer types, this returns None since the value needs conversion

Source§

impl Value

Source

pub fn is_i32(&self) -> bool

Checks if this value can be converted to the given type

Source

pub fn from_i32(value: i32) -> Value

Converts the given value into a Value

Source

pub fn into_i32(self) -> Result<i32, Error>

Attempts to convert a SurrealDB value into the given type

Source

pub fn is_i32_and(&self, callback: impl FnOnce(&i32) -> bool) -> bool

Checks if this value matches the type and passes the callback check

Source

pub fn as_i32(&self) -> Option<i32>

Returns a reference-like value if it matches the expected type Note: For integer types, this returns None since the value needs conversion

Source§

impl Value

Source

pub fn is_isize(&self) -> bool

Checks if this value can be converted to the given type

Source

pub fn from_isize(value: isize) -> Value

Converts the given value into a Value

Source

pub fn into_isize(self) -> Result<isize, Error>

Attempts to convert a SurrealDB value into the given type

Source

pub fn is_isize_and(&self, callback: impl FnOnce(&isize) -> bool) -> bool

Checks if this value matches the type and passes the callback check

Source

pub fn as_isize(&self) -> Option<isize>

Returns a reference-like value if it matches the expected type Note: For integer types, this returns None since the value needs conversion

Source§

impl Value

Source

pub fn is_u8(&self) -> bool

Checks if this value can be converted to the given type

Source

pub fn from_u8(value: u8) -> Value

Converts the given value into a Value

Source

pub fn into_u8(self) -> Result<u8, Error>

Attempts to convert a SurrealDB value into the given type

Source

pub fn is_u8_and(&self, callback: impl FnOnce(&u8) -> bool) -> bool

Checks if this value matches the type and passes the callback check

Source

pub fn as_u8(&self) -> Option<u8>

Returns a reference-like value if it matches the expected type Note: For integer types, this returns None since the value needs conversion

Source§

impl Value

Source

pub fn is_u16(&self) -> bool

Checks if this value can be converted to the given type

Source

pub fn from_u16(value: u16) -> Value

Converts the given value into a Value

Source

pub fn into_u16(self) -> Result<u16, Error>

Attempts to convert a SurrealDB value into the given type

Source

pub fn is_u16_and(&self, callback: impl FnOnce(&u16) -> bool) -> bool

Checks if this value matches the type and passes the callback check

Source

pub fn as_u16(&self) -> Option<u16>

Returns a reference-like value if it matches the expected type Note: For integer types, this returns None since the value needs conversion

Source§

impl Value

Source

pub fn is_u32(&self) -> bool

Checks if this value can be converted to the given type

Source

pub fn from_u32(value: u32) -> Value

Converts the given value into a Value

Source

pub fn into_u32(self) -> Result<u32, Error>

Attempts to convert a SurrealDB value into the given type

Source

pub fn is_u32_and(&self, callback: impl FnOnce(&u32) -> bool) -> bool

Checks if this value matches the type and passes the callback check

Source

pub fn as_u32(&self) -> Option<u32>

Returns a reference-like value if it matches the expected type Note: For integer types, this returns None since the value needs conversion

Source§

impl Value

Source

pub fn is_u64(&self) -> bool

Checks if this value can be converted to the given type

Source

pub fn from_u64(value: u64) -> Value

Converts the given value into a Value

Source

pub fn into_u64(self) -> Result<u64, Error>

Attempts to convert a SurrealDB value into the given type

Source

pub fn is_u64_and(&self, callback: impl FnOnce(&u64) -> bool) -> bool

Checks if this value matches the type and passes the callback check

Source

pub fn as_u64(&self) -> Option<u64>

Returns a reference-like value if it matches the expected type Note: For integer types, this returns None since the value needs conversion

Source§

impl Value

Source

pub fn is_usize(&self) -> bool

Checks if this value can be converted to the given type

Source

pub fn from_usize(value: usize) -> Value

Converts the given value into a Value

Source

pub fn into_usize(self) -> Result<usize, Error>

Attempts to convert a SurrealDB value into the given type

Source

pub fn is_usize_and(&self, callback: impl FnOnce(&usize) -> bool) -> bool

Checks if this value matches the type and passes the callback check

Source

pub fn as_usize(&self) -> Option<usize>

Returns a reference-like value if it matches the expected type Note: For integer types, this returns None since the value needs conversion

Source§

impl Value

Source

pub fn is_f32(&self) -> bool

Checks if this value can be converted to the given type

Source

pub fn from_f32(value: f32) -> Value

Converts the given value into a Value

Source

pub fn into_f32(self) -> Result<f32, Error>

Attempts to convert a SurrealDB value into the given type

Source

pub fn is_f32_and(&self, callback: impl FnOnce(&f32) -> bool) -> bool

Checks if this value matches the type and passes the callback check

Source

pub fn as_f32(&self) -> Option<f32>

Returns the converted value if it matches the expected type Note: For float types, this returns a converted value, not a reference

Source§

impl Value

Source

pub fn into_json_value(self) -> Value

Converts the value into a json representation of the value. Returns None if there are non serializable values present in the value.

Source§

impl Value

Source

pub fn kind(&self) -> Kind

Returns the kind of this value

This method maps each value variant to its corresponding Kind.

Source

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

Returns the first value in the array.

Returns None if the value is not an array or the array is empty.

Source

pub fn is_nullish(&self) -> bool

Check if this Value is NONE or NULL

Source

pub fn is_empty(&self) -> bool

Check if this Value is empty.

Source

pub fn get<Idx>(&self, index: Idx) -> &Value
where Value: Indexable<Idx>,

Accesses the value found at a certain field if an object, and a certain index if an array. Will not err if no value is found at this point, instead returning a Value::None. If an Option<&Value> is desired, the .into_option() method can be used to perform the conversion.

Source

pub fn remove<Idx>(&mut self, index: Idx) -> Value
where Value: Indexable<Idx>,

Removes the value at the given index.

Returns Some(Value) if the value was removed, None if the value was not found.

Source

pub fn is<T>(&self) -> bool
where T: SurrealValue,

Checks if this value is of the specified type

Returns true if the value can be converted to the given type T.

Source

pub fn into_t<T>(self) -> Result<T, Error>
where T: SurrealValue,

Converts this value to the specified type

Returns Ok(T) if the conversion is successful, Err(Error) otherwise.

Source

pub fn from_t<T>(value: T) -> Value
where T: SurrealValue,

Creates a value from the specified type

Converts the given value of type T into a Value.

Source

pub fn is_kind(&self, kind: &Kind) -> bool

Check if this value matches the specified kind

Returns true if the value conforms to the given kind specification. This includes checking nested types for arrays, objects, records, etc.

Trait Implementations§

Source§

impl Clone for Value

Source§

fn clone(&self) -> Value

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Value

Source§

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

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

impl Default for Value

Source§

fn default() -> Value

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Value

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Value, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<Object> for Value

Source§

fn from(o: Object) -> Value

Converts to this type from the input type.
Source§

impl FromFlatbuffers for Value

Source§

type Input<'a> = Value<'a>

The input type from the flatbuffers builder
Source§

fn from_fb(input: <Value as FromFlatbuffers>::Input<'_>) -> Result<Value, Error>

Convert a flatbuffers builder type to a type.
Source§

impl FromIterator<Value> for Value

Source§

fn from_iter<I>(iter: I) -> Value
where I: IntoIterator<Item = Value>,

Creates a value from an iterator. Read more
Source§

impl Hash for Value

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Index<&str> for Value

Source§

type Output = Value

The returned type after indexing.
Source§

fn index(&self, index: &str) -> &<Value as Index<&str>>::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl Index<usize> for Value

Source§

type Output = Value

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &<Value as Index<usize>>::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl Indexable<&str> for Value

Source§

fn get(&self, index: &str) -> &Value

Get the value at the given index.
Source§

fn remove(&mut self, index: &str) -> Value

Remove the value at the given index.
Source§

impl Indexable<usize> for Value

Source§

fn get(&self, index: usize) -> &Value

Get the value at the given index.
Source§

fn remove(&mut self, index: usize) -> Value

Remove the value at the given index.
Source§

impl Ord for Value

Source§

fn cmp(&self, other: &Value) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq<&Value> for Value

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Value> for &Value

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Value> for RecordIdKey

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for Value

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Value

Source§

fn partial_cmp(&self, other: &Value) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl RangeBounds<Value> for Range

Source§

fn start_bound(&self) -> Bound<&Value>

Start index bound. Read more
Source§

fn end_bound(&self) -> Bound<&Value>

End index bound. Read more
Source§

fn contains<U>(&self, item: &U) -> bool

Returns true if item is contained in the range. Read more
Source§

fn is_empty(&self) -> bool
where T: PartialOrd,

🔬This is a nightly-only experimental API. (range_bounds_is_empty)
Returns true if the range contains no items. One-sided ranges (RangeFrom, etc) always return false. Read more
Source§

impl Serialize for Value

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl SurrealValue for Value

Source§

fn kind_of() -> Kind

Returns the kind that represents this type
Source§

fn is_value(_value: &Value) -> bool

Checks if the given value can be converted to this type
Source§

fn into_value(self) -> Value

Converts this type into a SurrealDB value
Source§

fn from_value(value: Value) -> Result<Value, Error>

Attempts to convert a SurrealDB value into this type
Source§

impl ToFlatbuffers for Value

Source§

type Output<'bldr> = WIPOffset<Value<'bldr>>

The output type for the flatbuffers builder
Source§

fn to_fb<'bldr>( &self, builder: &mut FlatBufferBuilder<'bldr>, ) -> Result<<Value as ToFlatbuffers>::Output<'bldr>, Error>

Convert the type to a flatbuffers builder type.
Source§

impl ToSql for Value

Source§

fn fmt_sql(&self, f: &mut String, fmt: SqlFormat)

Format the type to a SQL string.
Source§

fn to_sql(&self) -> String

Convert the type to a SQL string.
Source§

fn to_sql_pretty(&self) -> String

Convert the type to a pretty-printed SQL string with indentation.
Source§

impl Eq for Value

Source§

impl StructuralPartialEq for Value

Auto Trait Implementations§

§

impl !Freeze for Value

§

impl RefUnwindSafe for Value

§

impl Send for Value

§

impl Sync for Value

§

impl Unpin for Value

§

impl UnsafeUnpin for Value

§

impl UnwindSafe for Value

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<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

Source§

fn is_within(&self, b: &G2) -> bool

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,