rust-apk 1.0.0

Build, align, sign, verify, and inspect Android APKs in pure Rust
Documentation
use std::path::{Path, PathBuf};
use std::sync::Arc;

/// Input bytes, or a file streamed when an archive is written.
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
pub enum Content {
    Bytes(Arc<[u8]>),
    File(PathBuf),
}

impl From<Vec<u8>> for Content {
    fn from(bytes: Vec<u8>) -> Self {
        Self::Bytes(bytes.into())
    }
}

impl From<&[u8]> for Content {
    fn from(bytes: &[u8]) -> Self {
        Self::Bytes(bytes.into())
    }
}

impl<const N: usize> From<&[u8; N]> for Content {
    fn from(bytes: &[u8; N]) -> Self {
        Self::from(bytes.as_slice())
    }
}

impl From<PathBuf> for Content {
    fn from(path: PathBuf) -> Self {
        Self::File(path)
    }
}

impl From<&Path> for Content {
    fn from(path: &Path) -> Self {
        Self::File(path.to_owned())
    }
}