pub struct PackageBuilder { /* private fields */ }Expand description
A builder to simplify construction of Fuchsia packages.
Implementations§
Source§impl PackageBuilder
impl PackageBuilder
Sourcepub fn new(name: impl Into<String>) -> Self
pub fn new(name: impl Into<String>) -> Self
Creates a new PackageBuilder.
§Panics
Panics if either:
nameis an invalid package name.- Creating a tempdir fails.
Sourcepub fn new_with_abi_revision(
name: impl Into<String>,
abi_revision: AbiRevision,
) -> Self
pub fn new_with_abi_revision( name: impl Into<String>, abi_revision: AbiRevision, ) -> Self
Creates a new PackageBuilder, just like PackageBuilder::new(), but
allowing the caller to specify the ABI revision with which to stamp the
test package.
Sourcepub fn dir(self, path: impl Into<PathBuf>) -> PackageDir
pub fn dir(self, path: impl Into<PathBuf>) -> PackageDir
Create a subdirectory within the package.
§Panics
Panics if the package contains a file entry at path or any of its ancestors.
Sourcepub fn add_resource_at(
self,
path: impl Into<PathBuf>,
contents: impl Read,
) -> Self
pub fn add_resource_at( self, path: impl Into<PathBuf>, contents: impl Read, ) -> Self
Adds the provided contents to the package at the given path.
§Panics
Panics if either:
- The package already contains a file or directory at
path. - The package contains a file at any of
path’s ancestors.
Sourcepub fn add_subpackage(
self,
name: impl TryInto<RelativePackageUrl>,
subpackage: &Package,
) -> Self
pub fn add_subpackage( self, name: impl TryInto<RelativePackageUrl>, subpackage: &Package, ) -> Self
Adds the provided subpackage to the package with name name.
§Panics
Panics if either:
nameis not a valid RelativePackageUrl- There is already a subpackage called
name
Sourcepub fn add_subpackage_by_hash(
self,
name: impl TryInto<RelativePackageUrl>,
hash: Hash,
) -> Self
pub fn add_subpackage_by_hash( self, name: impl TryInto<RelativePackageUrl>, hash: Hash, ) -> Self
Adds a subpackage with name name and hash hash to the package.
Because the blobs of the subpackage are not provided, the Package built from this
PackageBuilder will not have the subpackage blobs.
§Panics
Panics if either:
nameis not a valid RelativePackageUrl- There is already a subpackage called
name
Auto Trait Implementations§
impl Freeze for PackageBuilder
impl RefUnwindSafe for PackageBuilder
impl Send for PackageBuilder
impl Sync for PackageBuilder
impl Unpin for PackageBuilder
impl UnwindSafe for PackageBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
Converts the given service transport handle of type
T to [Self]§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoAny for T
impl<T> IntoAny for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T, U> TryIntoExt<U> for Twhere
U: TryFromExt<T>,
impl<T, U> TryIntoExt<U> for Twhere
U: TryFromExt<T>,
type Error = <U as TryFromExt<T>>::Error
§fn try_into_ext(self) -> Result<U, <T as TryIntoExt<U>>::Error>
fn try_into_ext(self) -> Result<U, <T as TryIntoExt<U>>::Error>
Tries to perform the conversion.