pub type PersistentRootedVector_Base = u8;
Expand description

A copyable, assignable global GC root type with arbitrary lifetime, an infallible constructor, and automatic unrooting on destruction.

These roots can be used in heap-allocated data structures, so they are not associated with any particular JSContext or stack. They are registered with the JSRuntime itself, without locking. Initialization may take place on construction, or in two phases if the no-argument constructor is called followed by init().

Note that you must not use an PersistentRooted in an object owned by a JS object:

Whenever one object whose lifetime is decided by the GC refers to another such object, that edge must be traced only if the owning JS object is traced. This applies not only to JS objects (which obviously are managed by the GC) but also to C++ objects owned by JS objects.

If you put a PersistentRooted in such a C++ object, that is almost certainly a leak. When a GC begins, the referent of the PersistentRooted is treated as live, unconditionally (because a PersistentRooted is a root), even if the JS object that owns it is unreachable. If there is any path from that referent back to the JS object, then the C++ object containing the PersistentRooted will not be destructed, and the whole blob of objects will not be freed, even if there are no references to them from the outside.

In the context of Firefox, this is a severe restriction: almost everything in Firefox is owned by some JS object or another, so using PersistentRooted in such objects would introduce leaks. For these kinds of edges, Heap or TenuredHeap would be better types. It’s up to the implementor of the type containing Heap or TenuredHeap members to make sure their referents get marked when the object itself is marked.

Trait Implementations§

source§

impl FromJSValConvertible for u8

§

type Config = ConversionBehavior

Optional configurable behaviour switch; use () for no configuration.
source§

unsafe fn from_jsval( cx: *mut JSContext, val: Handle<'_, Value>, option: ConversionBehavior ) -> Result<ConversionResult<u8>, ()>

Convert val to type Self. Optional configuration of type T can be passed as the option argument. If it returns Err(()), a JSAPI exception is pending. If it returns Ok(Failure(reason)), there is no pending JSAPI exception.
1.0.0 · source§

impl Ord for u8

source§

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

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

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

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

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

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

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

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

impl PartialEq<Value> for u8

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
1.0.0 · source§

impl PartialEq<u8> for u8

source§

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

This method tests for self and other values to be equal, and is used by ==.
source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
1.0.0 · source§

impl PartialOrd<u8> for u8

source§

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

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

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

This method tests less than (for self and other) and is used by the < operator. Read more
source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
source§

impl<R> ReadEndian<u8> for Rwhere R: Read,

source§

fn read_from_little_endian_into(&mut self, value: &mut u8) -> Result<(), Error>

Read into the supplied reference. Acts the same as std::io::Read::read_exact.
source§

fn read_from_big_endian_into(&mut self, value: &mut u8) -> Result<(), Error>

Read into the supplied reference. Acts the same as std::io::Read::read_exact.
source§

fn read_from_native_endian_into(&mut self, value: &mut T) -> Result<(), Error>

Read into the supplied reference. Acts the same as std::io::Read::read_exact.
source§

fn read_from_little_endian(&mut self) -> Result<T, Error>where T: Default,

Read the byte value of the inferred type
source§

fn read_from_big_endian(&mut self) -> Result<T, Error>where T: Default,

Read the byte value of the inferred type
source§

fn read_from_native_endian(&mut self) -> Result<T, Error>where T: Default,

Read the byte value of the inferred type
source§

impl ToJSValConvertible for u8

source§

unsafe fn to_jsval(&self, _cx: *mut JSContext, rval: MutableHandle<'_, Value>)

Convert self to a JSVal. JSAPI failure causes a panic.
source§

impl Traceable for u8

source§

unsafe fn trace(&self, _: *mut JSTracer)

Trace self.
source§

impl<W> WriteEndian<u8> for Wwhere W: Write,

source§

fn write_as_little_endian(&mut self, value: &u8) -> Result<(), Error>

Write the byte value of the specified reference, converting it to little endianness
source§

fn write_as_big_endian(&mut self, value: &u8) -> Result<(), Error>

Write the byte value of the specified reference, converting it to big endianness
source§

fn write_as_native_endian(&mut self, value: &T) -> Result<(), Error>

Write the byte value of the specified reference, not converting it
1.0.0 · source§

impl Eq for u8