Skip to main content

RealmFile

Struct RealmFile 

Source
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

Source

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.

Source

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.

Source

pub fn tables(&self) -> &[RealmTable]

All tables in the file, in the order they appear in the Group.

Source

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§

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.