pub struct RealmFile { /* private fields */ }Expand description
An opened and fully-parsed Realm database file.
Constructed via RealmFile::open or RealmFile::from_bytes.
Implementations§
Source§impl RealmFile
impl RealmFile
Sourcepub fn open<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn open<P: AsRef<Path>>(path: P) -> Result<Self>
Read and parse a .realm file from disk.
§Errors
Returns RealmError::Io if the file cannot be read, RealmError::InvalidFormat
if the binary layout is unexpected, or RealmError::UnsupportedVersion if the
format version is not 9.
Sourcepub fn from_bytes(data: &[u8]) -> Result<Self>
pub fn from_bytes(data: &[u8]) -> Result<Self>
Parse a Realm database from an in-memory byte slice.
Useful for testing or when the file is already loaded in memory.
Sourcepub fn tables(&self) -> &[RealmTable]
pub fn tables(&self) -> &[RealmTable]
All tables in the file, in the order they appear in the Group.
Sourcepub fn table(&self, name: &str) -> Option<&RealmTable>
pub fn table(&self, name: &str) -> Option<&RealmTable>
Find a table by exact name (e.g. "class_BlockDataModel").
Returns None if no table with that name exists.
Auto Trait Implementations§
impl Freeze for RealmFile
impl RefUnwindSafe for RealmFile
impl Send for RealmFile
impl Sync for RealmFile
impl Unpin for RealmFile
impl UnsafeUnpin for RealmFile
impl UnwindSafe for RealmFile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more