Skip to content

Commit

Permalink
Merge pull request #1598 from nightkr/feature/objectref-from
Browse files Browse the repository at this point in the history
Add ObjectRef::from as alias for ::from_obj
  • Loading branch information
nightkr authored Oct 9, 2024
2 parents 62f95cd + 1ed864a commit 023ecc3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions kube-runtime/src/reflector/object_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,20 @@ where
}

#[must_use]
pub fn from_obj(obj: &K) -> Self
where
K: Lookup,
{
pub fn from_obj(obj: &K) -> Self {
obj.to_object_ref(Default::default())
}
}

impl<K: Lookup> From<&K> for ObjectRef<K>
where
K::DynamicType: Default,
{
fn from(obj: &K) -> Self {
Self::from_obj(obj)
}
}

impl<K: Lookup> ObjectRef<K> {
#[must_use]
pub fn new_with(name: &str, dyntype: K::DynamicType) -> Self {
Expand Down

0 comments on commit 023ecc3

Please sign in to comment.