INNER CODE UNIT · Rust
extract_age
databricks/click · src/command/mod.rs:311
pub fn extract_age<T: Metadata<Ty = ObjectMeta>>(obj: &T) -> Option<CellSpec<'_>> {
let meta = obj.metadata();
meta.creation_timestamp.as_ref().map(|ts| ts.0.into())
}
/// An extractor for the Namespace field. Extracts the namespace out of the object metadata
pub fn extract_namespace<T: Metadata<Ty = ObjectMeta>>(obj: &T) -> Option<Cow<'_, str>> {
let meta = obj.metadata();
meta.namespace.as_ref().map(|ns| ns.as_str().into())
}
/// An extractor for the Labels field. Extracts the labels out of the object metadata
pub fn extract_labels<T: Metadata<Ty = ObjectMeta>>(obj: &T) -> Option<Cow<'_, str>> {
let meta = obj.metadata();
meta.labels
.as_ref()
.map(|labels| keyval_string(labels.iter(), None).into())
}