d4566ff6ea
Instead of creating a new Vec<_> for every embedded path part, we now use a reference when calling get/set/del on a value’s data. This means we aren’t creating and copying the Vec items each and every time we traverse down a path.
17 lines
340 B
Rust
17 lines
340 B
Rust
use crate::dbs::Options;
|
|
use crate::dbs::Runtime;
|
|
use crate::dbs::Transaction;
|
|
use crate::err::Error;
|
|
use crate::sql::part::Part;
|
|
use crate::sql::value::Value;
|
|
|
|
impl Value {
|
|
pub async fn first(
|
|
&self,
|
|
ctx: &Runtime,
|
|
opt: &Options,
|
|
txn: &Transaction,
|
|
) -> Result<Self, Error> {
|
|
self.get(ctx, opt, txn, &[Part::First]).await
|
|
}
|
|
}
|