[][src]Struct artichoke_backend::state::parser::Context

pub struct Context { /* fields omitted */ }

Context is used to manipulate the current filename on the parser.

Parser State maintains a stack of Contexts and eval uses the Context stack to set the __FILE__ magic constant.

Implementations

impl Context[src]

pub fn new<T>(filename: T) -> Option<Self> where
    T: Into<Cow<'static, [u8]>>, 
[src]

Create a new Context.

pub unsafe fn new_unchecked<T>(filename: T) -> Self where
    T: Into<Cow<'static, [u8]>>, 
[src]

Create a new Context without checking for NUL bytes in the filename.

Safety

filename must not contain any NUL bytes. filename must not contain a trailing NUL.

#[must_use]pub fn root() -> Self[src]

Create a root, or default, Context.

The root context sets the __FILE__ magic constant to "(eval)".

#[must_use]pub fn filename(&self) -> &[u8][src]

Filename of this Context.

#[must_use]pub fn filename_as_c_str(&self) -> &CStr[src]

FFI-safe NUL-terminated C String of this Context.

This CStr is valid as long as this Context is not dropped.

Trait Implementations

impl Clone for Context[src]

impl Debug for Context[src]

impl Default for Context[src]

impl Eq for Context[src]

impl Hash for Context[src]

impl Ord for Context[src]

impl PartialEq<Context> for Context[src]

impl PartialOrd<Context> for Context[src]

impl StructuralEq for Context[src]

impl StructuralPartialEq for Context[src]

Auto Trait Implementations

impl RefUnwindSafe for Context[src]

impl Send for Context[src]

impl Sync for Context[src]

impl Unpin for Context[src]

impl UnwindSafe for Context[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]