Struct CString

Source
pub struct CString<'js> { /* private fields */ }
Expand description

Rust representation of a JavaScript C string.

Implementations§

Source§

impl<'js> CString<'js>

Source

pub fn from_string(string: String<'js>) -> Result<Self>

Create a new JavaScript C string from a JavaScript string.

Source

pub fn as_ptr(&self) -> *const c_char

Converts a CString to a raw pointer.

Source

pub fn len(&self) -> usize

Returns the length of this CString, in bytes (not chars or graphemes).

Source

pub fn is_empty(&self) -> bool

Returns true if this CString has a length of zero, and false otherwise.

Source

pub fn as_str(&self) -> &str

Extracts a string slice containing the entire CString.

Trait Implementations§

Source§

impl<'js> Debug for CString<'js>

Source§

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

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

impl<'js> Drop for CString<'js>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<'js> FromJs<'js> for CString<'js>

Source§

fn from_js(_ctx: &Ctx<'js>, value: Value<'js>) -> Result<Self>

Source§

impl<'js> IntoJs<'js> for &CString<'js>

Source§

fn into_js(self, ctx: &Ctx<'js>) -> Result<Value<'js>>

Source§

impl<'js> IntoJs<'js> for CString<'js>

Source§

fn into_js(self, ctx: &Ctx<'js>) -> Result<Value<'js>>

Source§

impl<'js> JsLifetime<'js> for CString<'js>

Source§

type Changed<'to> = CString<'to>

The target which has the same type as a Self but with another lifetime 't

Auto Trait Implementations§

§

impl<'js> Freeze for CString<'js>

§

impl<'js> RefUnwindSafe for CString<'js>

§

impl<'js> !Send for CString<'js>

§

impl<'js> !Sync for CString<'js>

§

impl<'js> Unpin for CString<'js>

§

impl<'js> !UnwindSafe for CString<'js>

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<'js, T> AsProperty<'js, T> for T
where T: IntoJs<'js>,

Source§

fn config( self, ctx: &Ctx<'js>, ) -> Result<(i32, Value<'js>, Value<'js>, Value<'js>), Error>

Property configuration 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<'js, T> FromParam<'js> for T
where T: FromJs<'js>,

Source§

fn param_requirement() -> ParamRequirement

The parameters requirements this value requires.
Source§

fn from_param<'a>(params: &mut ParamsAccessor<'a, 'js>) -> Result<T, Error>

Convert from a parameter value.
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<'js, T> IntoArg<'js> for T
where T: IntoJs<'js>,

Source§

fn num_args(&self) -> usize

The number of arguments this value produces.
Source§

fn into_arg(self, args: &mut Args<'js>) -> Result<(), Error>

Convert the value into an argument.
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, 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<T> ParallelSend for T