37 lines
840 B
Rust
37 lines
840 B
Rust
use allocative::Allocative;
|
|
use starlark::values::StarlarkValue;
|
|
use starlark_derive::{NoSerialize, ProvidesStaticType, starlark_value};
|
|
|
|
use crate::recipe::Metadata;
|
|
|
|
#[derive(Debug, Clone, Allocative, ProvidesStaticType, NoSerialize)]
|
|
pub struct Subpackage {
|
|
name: String,
|
|
metadata: Metadata,
|
|
}
|
|
|
|
impl Subpackage {
|
|
pub fn new(name: String, metadata: Metadata) -> Self {
|
|
Self { name, metadata }
|
|
}
|
|
|
|
pub fn name(&self) -> &str {
|
|
&self.name
|
|
}
|
|
|
|
pub fn metadata(&self) -> &Metadata {
|
|
&self.metadata
|
|
}
|
|
}
|
|
|
|
impl std::fmt::Display for Subpackage {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
write!(f, "subpackage")
|
|
}
|
|
}
|
|
|
|
starlark::starlark_simple_value!(Subpackage);
|
|
|
|
#[starlark_value(type = "subpackage")]
|
|
impl<'v> StarlarkValue<'v> for Subpackage {}
|