Struct mft::attribute::x30::FileNameAttr

source ·
pub struct FileNameAttr {
    pub parent: MftReference,
    pub created: DateTime<Utc>,
    pub modified: DateTime<Utc>,
    pub mft_modified: DateTime<Utc>,
    pub accessed: DateTime<Utc>,
    pub logical_size: u64,
    pub physical_size: u64,
    pub flags: FileAttributeFlags,
    pub reparse_value: u32,
    pub name_length: u8,
    pub namespace: FileNamespace,
    pub name: String,
}

Fields§

§parent: MftReference§created: DateTime<Utc>§modified: DateTime<Utc>§mft_modified: DateTime<Utc>§accessed: DateTime<Utc>§logical_size: u64§physical_size: u64§flags: FileAttributeFlags§reparse_value: u32§name_length: u8§namespace: FileNamespace§name: String

Implementations§

source§

impl FileNameAttr

source

pub fn from_stream<S: Read + Seek>(stream: &mut S) -> Result<FileNameAttr>

Parse a Filename attrbiute buffer.

Example

Parse a raw buffer.

use mft::attribute::x30::{FileNameAttr, FileNamespace};
let attribute_buffer: &[u8] = &[
    0x05,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0xD5,0x2D,0x48,0x58,0x43,0x5F,0xCE,0x01,
    0xD5,0x2D,0x48,0x58,0x43,0x5F,0xCE,0x01,0xD5,0x2D,0x48,0x58,0x43,0x5F,0xCE,0x01,
    0xD5,0x2D,0x48,0x58,0x43,0x5F,0xCE,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x08,0x03,0x24,0x00,0x4C,0x00,0x6F,0x00,0x67,0x00,0x46,0x00,0x69,0x00,0x6C,0x00,
    0x65,0x00,0x00,0x00,0x00,0x00,0x00,0x00
];

let attribute = FileNameAttr::from_stream(&mut Cursor::new(attribute_buffer)).unwrap();

assert_eq!(attribute.parent.entry, 5);
assert_eq!(attribute.created.timestamp(), 1370144608);
assert_eq!(attribute.modified.timestamp(), 1370144608);
assert_eq!(attribute.mft_modified.timestamp(), 1370144608);
assert_eq!(attribute.accessed.timestamp(), 1370144608);
assert_eq!(attribute.logical_size, 67108864);
assert_eq!(attribute.physical_size, 67108864);
assert_eq!(attribute.flags.bits(), 6);
assert_eq!(attribute.reparse_value, 0);
assert_eq!(attribute.name_length, 8);
assert_eq!(attribute.namespace, FileNamespace::Win32AndDos);
assert_eq!(attribute.name, "$LogFile");

Trait Implementations§

source§

impl Clone for FileNameAttr

source§

fn clone(&self) -> FileNameAttr

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for FileNameAttr

source§

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

Formats the value using the given formatter. Read more
source§

impl Serialize for FileNameAttr

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.