pub struct BytesDataMap<U: Ui>(/* private fields */);
Implementations§
Source§impl<U: Ui> BytesDataMap<U>
impl<U: Ui> BytesDataMap<U>
Sourcepub fn read<Ret>(&self, pa: &Pass, f: impl FnOnce(&Bytes) -> Ret) -> Ret
pub fn read<Ret>(&self, pa: &Pass, f: impl FnOnce(&Bytes) -> Ret) -> Ret
Reads the Bytes
of the File
’s Text
If you are looking at this method from the context of
Reader::apply_changes
, you probably actually want to use
BytesDataMap::write_with_reader
, since it is far more
compatible with that usecase.
§Panics
Panics if there is a mutable borrow of this struct somewhere,
which could happen if you use RwData::write_unsafe
or
RwData::write_unsafe_as
Sourcepub fn write_with_reader<Ret, Rd: Reader<U>>(
&self,
pa: &mut Pass,
rd: &RwData<Rd>,
f: impl FnOnce(&mut Bytes, &mut Rd) -> Ret,
) -> Ret
pub fn write_with_reader<Ret, Rd: Reader<U>>( &self, pa: &mut Pass, rd: &RwData<Rd>, f: impl FnOnce(&mut Bytes, &mut Rd) -> Ret, ) -> Ret
Reads the Bytes
of a File
, alongside a Reader
This can be very convenient when you want access to these two
things at once, and is completely safe, since File
doesn’t
implement Reader
, the other RwData
will never be
RwData<File>
, so a double borrow could never happen.
§Panics
Panics if there is are any borrows of either struct elsewhere,
which could happen if you use RwData::write_unsafe
or
RwData::write_unsafe_as
Sourcepub fn has_changed(&self) -> bool
pub fn has_changed(&self) -> bool
Wether someone else called write
or write_as
since the
last read
or write
Do note that this DOES NOT mean that the value inside has
actually been changed, it just means a mutable reference was
acquired after the last call to has_changed
.
Generally though, you can use this method to gauge that.
Trait Implementations§
Source§impl<U: Clone + Ui> Clone for BytesDataMap<U>
impl<U: Clone + Ui> Clone for BytesDataMap<U>
Source§fn clone(&self) -> BytesDataMap<U>
fn clone(&self) -> BytesDataMap<U>
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read more