[−][src]Struct tremor_script::LineValue
Rental wrapped value with the data it was parsed from from
Methods
impl Value
[src]
pub fn new<__Fparsed>(raw: Vec<Vec<u8>>, parsed: __Fparsed) -> Self where
__Fparsed: for<'raw> FnOnce(&'raw mut [Vec<u8>]) -> ValueAndMeta<'raw>,
[src]
__Fparsed: for<'raw> FnOnce(&'raw mut [Vec<u8>]) -> ValueAndMeta<'raw>,
Create a new instance of the rental struct.
The first argument provided is the head, followed by a series of closures, one for each tail field. Each of these closures will receive, as its arguments, a borrow of the previous field, followed by borrows of the remaining prefix fields if the struct is a shared rental. If the struct is a mutable rental, only the immediately preceding field is passed.
pub fn try_new<__Fparsed, __E>(
raw: Vec<Vec<u8>>,
parsed: __Fparsed
) -> RentalResult<Self, __E, Vec<Vec<u8>>> where
__Fparsed: for<'raw> FnOnce(&'raw mut [Vec<u8>]) -> Result<ValueAndMeta<'raw>, __E>,
[src]
raw: Vec<Vec<u8>>,
parsed: __Fparsed
) -> RentalResult<Self, __E, Vec<Vec<u8>>> where
__Fparsed: for<'raw> FnOnce(&'raw mut [Vec<u8>]) -> Result<ValueAndMeta<'raw>, __E>,
Attempt to create a new instance of the rental struct.
As new
, but each closure returns a Result
. If one of them fails, execution is short-circuited and a tuple of the error and the original head value is returned to you.
pub fn try_new_or_drop<__Fparsed, __E>(
raw: Vec<Vec<u8>>,
parsed: __Fparsed
) -> Result<Self, __E> where
__Fparsed: for<'raw> FnOnce(&'raw mut [Vec<u8>]) -> Result<ValueAndMeta<'raw>, __E>,
[src]
raw: Vec<Vec<u8>>,
parsed: __Fparsed
) -> Result<Self, __E> where
__Fparsed: for<'raw> FnOnce(&'raw mut [Vec<u8>]) -> Result<ValueAndMeta<'raw>, __E>,
Attempt to create a new instance of the rental struct.
As try_new
, but only the error value is returned upon failure; the head value is dropped. This method interacts more smoothly with existing error conversions.
pub unsafe fn all_erased(&self) -> Self::Borrow
[src]
Return lifetime-erased shared borrows of the fields of the struct.
This is unsafe because the erased lifetimes are fake. Use this only if absolutely necessary and be very mindful of what the true lifetimes are.
pub unsafe fn all_mut_erased(&mut self) -> Self::BorrowMut
[src]
Return a lifetime-erased mutable borrow of the suffix of the struct.
This is unsafe because the erased lifetimes are fake. Use this only if absolutely necessary and be very mindful of what the true lifetimes are.
pub fn rent<__F, __R>(&self, f: __F) -> __R where
__F: for<'parsed, 'raw> FnOnce(&'parsed ValueAndMeta<'raw>) -> __R,
__R: ,
[src]
__F: for<'parsed, 'raw> FnOnce(&'parsed ValueAndMeta<'raw>) -> __R,
__R: ,
Execute a closure on the shared suffix of the struct.
The closure may return any value not bounded by one of the special rental lifetimes of the struct.
pub fn rent_mut<__F, __R>(&mut self, f: __F) -> __R where
__F: for<'parsed, 'raw> FnOnce(&'parsed mut ValueAndMeta<'raw>) -> __R,
__R: ,
[src]
__F: for<'parsed, 'raw> FnOnce(&'parsed mut ValueAndMeta<'raw>) -> __R,
__R: ,
Execute a closure on the mutable suffix of the struct.
The closure may return any value not bounded by one of the special rental lifetimes of the struct.
pub fn ref_rent<__F, __R>(&self, f: __F) -> &__R where
__F: for<'parsed, 'raw> FnOnce(&'parsed ValueAndMeta<'raw>) -> &'parsed __R,
__R: ?Sized,
[src]
__F: for<'parsed, 'raw> FnOnce(&'parsed ValueAndMeta<'raw>) -> &'parsed __R,
__R: ?Sized,
Return a shared reference from the shared suffix of the struct.
This is a subtle variation of rent
where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.
pub fn maybe_ref_rent<__F, __R>(&self, f: __F) -> Option<&__R> where
__F: for<'parsed, 'raw> FnOnce(&'parsed ValueAndMeta<'raw>) -> Option<&'parsed __R>,
__R: ?Sized,
[src]
__F: for<'parsed, 'raw> FnOnce(&'parsed ValueAndMeta<'raw>) -> Option<&'parsed __R>,
__R: ?Sized,
Optionally return a shared reference from the shared suffix of the struct.
This is a subtle variation of rent
where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.
pub fn try_ref_rent<__F, __R, __E>(&self, f: __F) -> Result<&__R, __E> where
__F: for<'parsed, 'raw> FnOnce(&'parsed ValueAndMeta<'raw>) -> Result<&'parsed __R, __E>,
__R: ?Sized,
[src]
__F: for<'parsed, 'raw> FnOnce(&'parsed ValueAndMeta<'raw>) -> Result<&'parsed __R, __E>,
__R: ?Sized,
Try to return a shared reference from the shared suffix of the struct, or an error on failure.
This is a subtle variation of rent
where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.
pub fn ref_rent_mut<__F, __R>(&mut self, f: __F) -> &mut __R where
__F: for<'parsed, 'raw> FnOnce(&'parsed mut ValueAndMeta<'raw>) -> &'parsed mut __R,
__R: ?Sized,
[src]
__F: for<'parsed, 'raw> FnOnce(&'parsed mut ValueAndMeta<'raw>) -> &'parsed mut __R,
__R: ?Sized,
Return a mutable reference from the mutable suffix of the struct.
This is a subtle variation of rent_mut
where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.
pub fn maybe_ref_rent_mut<__F, __R>(&mut self, f: __F) -> Option<&mut __R> where
__F: for<'parsed, 'raw> FnOnce(&'parsed mut ValueAndMeta<'raw>) -> Option<&'parsed mut __R>,
__R: ?Sized,
[src]
__F: for<'parsed, 'raw> FnOnce(&'parsed mut ValueAndMeta<'raw>) -> Option<&'parsed mut __R>,
__R: ?Sized,
Optionally return a mutable reference from the mutable suffix of the struct.
This is a subtle variation of rent_mut
where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.
pub fn try_ref_rent_mut<__F, __R, __E>(
&mut self,
f: __F
) -> Result<&mut __R, __E> where
__F: for<'parsed, 'raw> FnOnce(&'parsed mut ValueAndMeta<'raw>) -> Result<&'parsed mut __R, __E>,
__R: ?Sized,
[src]
&mut self,
f: __F
) -> Result<&mut __R, __E> where
__F: for<'parsed, 'raw> FnOnce(&'parsed mut ValueAndMeta<'raw>) -> Result<&'parsed mut __R, __E>,
__R: ?Sized,
Try to return a mutable reference from the mutable suffix of the struct, or an error on failure.
This is a subtle variation of rent_mut
where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.
pub fn into_head(self) -> Vec<Vec<u8>>
[src]
Drop the rental struct and return the original head value to you.
impl Value
[src]
pub fn all<'__s>(&'__s self) -> Self::Borrow
[src]
Borrow all fields of the struct by reborrowing away the rental lifetimes.
This is safe because the lifetimes are verified to be covariant first.
pub fn suffix(&self) -> <Self::Borrow as IntoSuffix>::Suffix
[src]
Borrow the suffix field of the struct by reborrowing away the rental lifetimes.
This is safe because the lifetimes are verified to be covariant first.
impl Value
[src]
pub fn parts<'value, 'borrow>(
&'borrow self
) -> (&'borrow mut Value<'value>, &'borrow mut Value<'value>) where
'borrow: 'value,
[src]
&'borrow self
) -> (&'borrow mut Value<'value>, &'borrow mut Value<'value>) where
'borrow: 'value,
Borrow the parts (event and metadata) from a rental. This borrows the data as immutable and then transmutes it to be mutable.
pub fn consume<'run, E, F>(
&'run mut self,
other: Self,
join_f: F
) -> Result<(), E> where
E: Error,
F: Fn(&mut ValueAndMeta<'static>, ValueAndMeta<'static>) -> Result<(), E>,
[src]
&'run mut self,
other: Self,
join_f: F
) -> Result<(), E> where
E: Error,
F: Fn(&mut ValueAndMeta<'static>, ValueAndMeta<'static>) -> Result<(), E>,
Consumes an event into another This function works around a rental limitation that is meant to protect its users: Rental does not allow you to get both the owned and borrowed part at the same time.
The reason for that is that once those are taken out of the rental the link of lifetimes between them would be broken and you'd risk invalid pointers or memory leaks. We however do not really want to take them out, all we want is combine two rentals. We can do this since:
- the owned values are inside a vector, while the vector itself may be relocated by adding to it, the values in it will stay in the same location.
- we are only ever adding / extending never deleting or modifying.
So what this function does it is crowbars the content
from a rental into an accessible struct then uses this
to modify its content by adding the owned parts of
other
into the owned part self
and the running
a merge function on the borrowed parts
Trait Implementations
impl Clone for LineValue
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Value where
ValueAndMeta<'static>: Debug,
[src]
ValueAndMeta<'static>: Debug,
impl<'de> Deserialize<'de> for LineValue
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
impl From<(Value<'static>, HashMap<Cow<'static, str>, Value<'static>, BuildHasherDefault<FxHasher>>)> for Value
[src]
impl From<(Value<'static>, Value<'static>)> for Value
[src]
fn from(v: (BorrowedValue<'static>, BorrowedValue<'static>)) -> Self
[src]
impl From<Value<'static>> for Value
[src]
fn from(v: BorrowedValue<'static>) -> Self
[src]
impl PartialEq<Value> for LineValue
[src]
impl<'raw: 'parsed, 'parsed> Rental2<'raw, 'parsed> for Value
[src]
impl Serialize for LineValue
[src]
Auto Trait Implementations
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> Downcast for T where
T: Any,
[src]
T: Any,
fn into_any(self: Box<T>) -> Box<dyn Any + 'static>
[src]
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
[src]
fn as_any(&self) -> &(dyn Any + 'static)
[src]
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
[src]
impl<T> DowncastSync for T where
T: Send + Sync + Any,
[src]
T: Send + Sync + Any,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,