Struct PartitionBuilder

Source
pub struct PartitionBuilder<TypedBuilderFields = ((), (), (), (), (), (), (), ())> { /* private fields */ }
Expand description

Configure and instantiate a Partition.

For usage, see PartitionBuilder::build.

Implementations§

Source§

impl<__attribute_bits, __partition_type, __name, __number, __size_in_sectors, __starting_sector, __uuid> PartitionBuilder<((), __attribute_bits, __partition_type, __name, __number, __size_in_sectors, __starting_sector, __uuid)>

Source

pub fn ask_size_interactive( self, ) -> PartitionBuilder<((bool,), __attribute_bits, __partition_type, __name, __number, __size_in_sectors, __starting_sector, __uuid)>

Call this function if you want to be able to set a different partition size when using a Partition instance as a template to add new partition in a partition table.

Source§

impl<__ask_size_interactive, __partition_type, __name, __number, __size_in_sectors, __starting_sector, __uuid> PartitionBuilder<(__ask_size_interactive, (), __partition_type, __name, __number, __size_in_sectors, __starting_sector, __uuid)>

Source

pub fn attribute_bits( self, bits: impl AsRef<[u8]>, ) -> PartitionBuilder<(__ask_size_interactive, (Option<Vec<u8>>,), __partition_type, __name, __number, __size_in_sectors, __starting_sector, __uuid)>

Set the partition attributes.

Source§

impl<__ask_size_interactive, __attribute_bits, __name, __number, __size_in_sectors, __starting_sector, __uuid> PartitionBuilder<(__ask_size_interactive, __attribute_bits, (), __name, __number, __size_in_sectors, __starting_sector, __uuid)>

Source

pub fn partition_type( self, partition_type: PartitionKind, ) -> PartitionBuilder<(__ask_size_interactive, __attribute_bits, (Option<PartitionKind>,), __name, __number, __size_in_sectors, __starting_sector, __uuid)>

Set the partition’s type.

Source§

impl<__ask_size_interactive, __attribute_bits, __partition_type, __number, __size_in_sectors, __starting_sector, __uuid> PartitionBuilder<(__ask_size_interactive, __attribute_bits, __partition_type, (), __number, __size_in_sectors, __starting_sector, __uuid)>

Source

pub fn name( self, name: impl Into<String>, ) -> PartitionBuilder<(__ask_size_interactive, __attribute_bits, __partition_type, (Option<String>,), __number, __size_in_sectors, __starting_sector, __uuid)>

Set the partition’s name.

Source§

impl<__ask_size_interactive, __attribute_bits, __partition_type, __name, __size_in_sectors, __starting_sector, __uuid> PartitionBuilder<(__ask_size_interactive, __attribute_bits, __partition_type, __name, (), __size_in_sectors, __starting_sector, __uuid)>

Source

pub fn number( self, number: usize, ) -> PartitionBuilder<(__ask_size_interactive, __attribute_bits, __partition_type, __name, (Option<usize>,), __size_in_sectors, __starting_sector, __uuid)>

Set the partition’s identification number. By default, set to the first free partition number available.

Source§

impl<__ask_size_interactive, __attribute_bits, __partition_type, __name, __number, __starting_sector, __uuid> PartitionBuilder<(__ask_size_interactive, __attribute_bits, __partition_type, __name, __number, (), __starting_sector, __uuid)>

Source

pub fn size_in_sectors( self, size_in_sectors: u64, ) -> PartitionBuilder<(__ask_size_interactive, __attribute_bits, __partition_type, __name, __number, (Option<u64>,), __starting_sector, __uuid)>

Set the partition’s size in sectors. By default, takes all the free space up to the last free sector.

Source§

impl<__ask_size_interactive, __attribute_bits, __partition_type, __name, __number, __size_in_sectors, __uuid> PartitionBuilder<(__ask_size_interactive, __attribute_bits, __partition_type, __name, __number, __size_in_sectors, (), __uuid)>

Source

pub fn starting_sector( self, starting_sector: u64, ) -> PartitionBuilder<(__ask_size_interactive, __attribute_bits, __partition_type, __name, __number, __size_in_sectors, (Option<u64>,), __uuid)>

Set the offset of the partition’s first sector with respect to the beginning of the device. By default, set to the first available free sector.

Source§

impl<__ask_size_interactive, __attribute_bits, __partition_type, __name, __number, __size_in_sectors, __starting_sector> PartitionBuilder<(__ask_size_interactive, __attribute_bits, __partition_type, __name, __number, __size_in_sectors, __starting_sector, ())>

Source

pub fn uuid( self, uuid: impl Into<String>, ) -> PartitionBuilder<(__ask_size_interactive, __attribute_bits, __partition_type, __name, __number, __size_in_sectors, __starting_sector, (Option<String>,))>

Set the partition’s UUID

Source§

impl<__ask_size_interactive: Optional<bool>, __attribute_bits: Optional<Option<Vec<u8>>>, __partition_type: Optional<Option<PartitionKind>>, __name: Optional<Option<String>>, __number: Optional<Option<usize>>, __size_in_sectors: Optional<Option<u64>>, __starting_sector: Optional<Option<u64>>, __uuid: Optional<Option<String>>> PartitionBuilder<(__ask_size_interactive, __attribute_bits, __partition_type, __name, __number, __size_in_sectors, __starting_sector, __uuid)>

Source

pub fn build(self) -> Result<Partition, PartitionBuilderError>

Completes a Partition’s configuration process, and creates a new instance.

Trait Implementations§

Source§

impl<TypedBuilderFields> Clone for PartitionBuilder<TypedBuilderFields>
where TypedBuilderFields: Clone,

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<TypedBuilderFields> Freeze for PartitionBuilder<TypedBuilderFields>
where TypedBuilderFields: Freeze,

§

impl<TypedBuilderFields> RefUnwindSafe for PartitionBuilder<TypedBuilderFields>
where TypedBuilderFields: RefUnwindSafe,

§

impl<TypedBuilderFields> Send for PartitionBuilder<TypedBuilderFields>
where TypedBuilderFields: Send,

§

impl<TypedBuilderFields> Sync for PartitionBuilder<TypedBuilderFields>
where TypedBuilderFields: Sync,

§

impl<TypedBuilderFields> Unpin for PartitionBuilder<TypedBuilderFields>
where TypedBuilderFields: Unpin,

§

impl<TypedBuilderFields> UnwindSafe for PartitionBuilder<TypedBuilderFields>
where TypedBuilderFields: UnwindSafe,

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.