GhostToken in ghost_cell::ghost_cell - Rust (2024)

source ·

pub struct GhostToken<'brand> { /* private fields */ }
Expand description

A GhostToken<'x> is the key to access the content of any &GhostCell<'x, _> sharing the same brand.

Each GhostToken<'x> is created alongside a unique brand (its lifetime), and each GhostCell<'x, T> is associatedto one, and only one, GhostToken at a time via this brand. The entire set of GhostCell<'x, T> associated to agiven GhostToken<'x> creates a pool of cells all being accessible solely through the one token they are associatedto.

The pool of GhostCell associated to a token need not be hom*ogeneous, each may own a value of a different type.

Implementations§

source§

impl<'brand> GhostToken<'brand>

source

pub fn new<R, F>(fun: F) -> R

where for<'new_brand> F: FnOnce(GhostToken<'new_brand>) -> R,

Creates a fresh token to which GhostCells can be tied to later.

Due to the use of a lifetime, the GhostCells tied to a given token can only live within the confines of theinvocation of the fun closure.

§Example
use ghost_cell::{GhostToken, GhostCell};let n = 12;let value = GhostToken::new(|mut token| { let cell = GhostCell::new(42); let vec: Vec<_> = (0..n).map(|_| &cell).collect(); *vec[n / 2].borrow_mut(&mut token) = 33; *cell.borrow(&token)});assert_eq!(33, value);

Trait Implementations§

source§

impl<'brand> Send for GhostToken<'brand>

A GhostToken is stateless, therefore it can safely be passed across threads.

source§

impl<'brand> Sync for GhostToken<'brand>

A GhostToken is stateless, therefore it can safely be accessed from different threads.

Auto Trait Implementations§

§

impl<'brand> RefUnwindSafe for GhostToken<'brand>

§

impl<'brand> Unpin for GhostToken<'brand>

§

impl<'brand> UnwindSafe for GhostToken<'brand>

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<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<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 ofFrom<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T

where U: Into<T>,

§

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>,

§

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.

GhostToken in ghost_cell::ghost_cell - Rust (2024)
Top Articles
Top 10 Network Tools & TCP/IP Utilities
Find the Details of Your Federal Loans
Katie Pavlich Bikini Photos
Gamevault Agent
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Free Atm For Emerald Card Near Me
Craigslist Mexico Cancun
Hendersonville (Tennessee) – Travel guide at Wikivoyage
Doby's Funeral Home Obituaries
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Select Truck Greensboro
How To Cut Eelgrass Grounded
Pac Man Deviantart
Alexander Funeral Home Gallatin Obituaries
Craigslist In Flagstaff
Shasta County Most Wanted 2022
Energy Healing Conference Utah
Testberichte zu E-Bikes & Fahrrädern von PROPHETE.
Aaa Saugus Ma Appointment
Geometry Review Quiz 5 Answer Key
Walgreens Alma School And Dynamite
Bible Gateway passage: Revelation 3 - New Living Translation
Yisd Home Access Center
Home
Shadbase Get Out Of Jail
Gina Wilson Angle Addition Postulate
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
Walmart Pharmacy Near Me Open
Dmv In Anoka
A Christmas Horse - Alison Senxation
Ou Football Brainiacs
Access a Shared Resource | Computing for Arts + Sciences
Pixel Combat Unblocked
Umn Biology
Cvs Sport Physicals
Mercedes W204 Belt Diagram
Rogold Extension
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Teenbeautyfitness
Weekly Math Review Q4 3
Facebook Marketplace Marrero La
Nobodyhome.tv Reddit
Topos De Bolos Engraçados
Gregory (Five Nights at Freddy's)
Grand Valley State University Library Hours
Holzer Athena Portal
Hampton In And Suites Near Me
Stoughton Commuter Rail Schedule
Bedbathandbeyond Flemington Nj
Free Carnival-themed Google Slides & PowerPoint templates
Otter Bustr
Selly Medaline
Latest Posts
Article information

Author: Ouida Strosin DO

Last Updated:

Views: 5619

Rating: 4.6 / 5 (76 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Ouida Strosin DO

Birthday: 1995-04-27

Address: Suite 927 930 Kilback Radial, Candidaville, TN 87795

Phone: +8561498978366

Job: Legacy Manufacturing Specialist

Hobby: Singing, Mountain biking, Water sports, Water sports, Taxidermy, Polo, Pet

Introduction: My name is Ouida Strosin DO, I am a precious, combative, spotless, modern, spotless, beautiful, precious person who loves writing and wants to share my knowledge and understanding with you.