Skip to main content

File

Struct File 

Source
pub struct File {
    pub identifier: ObjectIdentifier,
    pub object_name: String,
    pub file_type: String,
    pub file_size: u32,
    pub modification_date: Date,
    pub archive: bool,
    pub read_only: bool,
    pub file_access_method: FileAccessMethod,
    pub record_count: Option<u32>,
    pub description: String,
    pub file_data: Vec<u8>,
}
Expand description

File object implementation

Fields§

§identifier: ObjectIdentifier

Object identifier

§object_name: String

Object name

§file_type: String

File type (MIME type or file extension)

§file_size: u32

File size in octets

§modification_date: Date

Modification date (BACnet Date format)

§archive: bool

Archive flag

§read_only: bool

Read only flag

§file_access_method: FileAccessMethod

File access method

§record_count: Option<u32>

Record count (for record access method)

§description: String

Description

§file_data: Vec<u8>

File contents (in-memory storage for this implementation)

Implementations§

Source§

impl File

Source

pub fn new(instance: u32, object_name: String, file_type: String) -> Self

Create a new File object

Source

pub fn set_file_data(&mut self, data: Vec<u8>)

Set file contents

Source

pub fn get_file_data(&self) -> &[u8]

Get file contents

Source

pub fn read_data( &self, start_position: u32, requested_count: u32, ) -> Result<Vec<u8>>

Read data from file at specified position

Source

pub fn write_data(&mut self, start_position: u32, data: &[u8]) -> Result<()>

Write data to file at specified position

Source

pub fn read_records( &self, start_record: u32, record_count: u32, ) -> Result<Vec<Vec<u8>>>

Read records from file (for record access method)

Source

pub fn write_records( &mut self, start_record: u32, records: &[Vec<u8>], ) -> Result<()>

Write records to file (for record access method)

Trait Implementations§

Source§

impl BacnetObject for File

Source§

fn identifier(&self) -> ObjectIdentifier

Get the object identifier
Source§

fn get_property(&self, property: PropertyIdentifier) -> Result<PropertyValue>

Get a property value
Source§

fn set_property( &mut self, property: PropertyIdentifier, value: PropertyValue, ) -> Result<()>

Set a property value
Source§

fn is_property_writable(&self, property: PropertyIdentifier) -> bool

Check if property is writable
Source§

fn property_list(&self) -> Vec<PropertyIdentifier>

Get list of all properties
Source§

impl Clone for File

Source§

fn clone(&self) -> File

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for File

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for File

§

impl RefUnwindSafe for File

§

impl Send for File

§

impl Sync for File

§

impl Unpin for File

§

impl UnsafeUnpin for File

§

impl UnwindSafe for File

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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

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.