pub fn add_part<U>(
    gpt: &mut Gpt,
    info: &Info,
    uuid: U,
    partition_type: Uuid,
    start: Offset,
    end: End,
) -> Result<()>
where
    U: Into<Option<Uuid>>,
{
    info!(%partition_type, %start, ?end, "Adding partition");
    debug!(?gpt);
    let part = PartitionBuilder::new(uuid.into().unwrap_or_else(Uuid::new_v4), &gpt)
        .start(start / info.block_size)
        .partition_type(PartitionType::from_uuid(partition_type));
    let part = match end {
        End::Abs(end) => part.end(end / info.block_size),
        End::Rel(size) => part.size(size),
    };
    let part = part.finish();
    debug!(?part);
    gpt.add_partition(part)?;
    Ok(())
}
/// Add a partition to the Gpt.
Add a partition to the Gpt.
Add a partition to the Gpt .
pub fn add_part<U>(
    gpt: &mut Gpt,
    info: &Info,
    uuid: U,
    partition_type: Uuid,
    start: Offset,
    end: End,
) -> Result<()>
where
    U: Into<Option<Uuid>>,
{
    info!(%partition_type, %start, ?end, "Adding partition");
    debug!(?gpt);
    let part = PartitionBuilder::new(uuid.into().unwrap_or_else(Uuid::new_v4), &gpt)
        .start(start / info.block_size)
        .partition_type(PartitionType::from_uuid(partition_type));
    let part = match end {
        End::Abs(end) => part.end(end / info.block_size),
        End::Rel(size) => part.size(size),
    };
    let part = part.finish();
    debug!(?part);
    gpt.add_partition(part)?;
    Ok(())
}
pub fn add_part < U > ( gpt : & mut Gpt , info : & Info , uuid : U , partition_type : Uuid , start : Offset , end : End , ) -> Result < ( ) > where U : Into < Option < Uuid > > , { info ! ( partition_type start end " " ) ; debug ! ( gpt ) ; let part = PartitionBuilder :: new ( uuid . into ( ) . unwrap_or_else ( Uuid :: new_v4 ) , & gpt ) . start ( start / info . block_size ) . partition_type ( PartitionType :: from_uuid ( partition_type ) ) ; let part = match end { End :: Abs ( end ) => part . end ( end / info . block_size ) , End :: Rel ( size ) => part . size ( size ) , } ; let part = part . finish ( ) ; debug ! ( part ) ; gpt . add_partition ( part ) ? ; Ok ( ( ) ) }
Add a partition to the Gpt.
Add a partition to the Gpt .
gpt
&mut Gpt
info
&Info
uuid
U
partition_type
Uuid
start
Offset
end
End
gpt
&mut Gpt
info
&Info
uuid
U
partition_type
Uuid
start
Offset
end
End