Kube-rs: Help: How to create an object inside a watcher

Created on 28 Dec 2020  路  1Comment  路  Source: kube-rs/kube-rs

let cms = Api::<Secret>::all(client);
let mut w = watcher(cms, lp).boxed();
while let Some(event) = w.try_next().await? {
  // Create new secret here, but cms is moved and not available
}

I made this working by cloning cms as cms2 and then I can create an object using cms2, but is there some way to do this without cloning? I tried to use the reference, but watcher doesn't accept it.

question docs

Most helpful comment

The basic answer is to clone cms. The backing HTTP connection and machinery is multiplexed, so that should be fine.

>All comments

The basic answer is to clone cms. The backing HTTP connection and machinery is multiplexed, so that should be fine.

Was this page helpful?
0 / 5 - 0 ratings