pub struct ResolvedProtocolBinding { /* private fields */ }Expand description
Validated binding plus the exact local Candid sidecar admitted for transport.
Implementations§
Source§impl ResolvedProtocolBinding
impl ResolvedProtocolBinding
Sourcepub const fn binding(&self) -> &RegistryProtocolBinding
pub const fn binding(&self) -> &RegistryProtocolBinding
Return the exact immutable identity verified by the resolver.
Sourcepub fn candid_path(&self) -> &Path
pub fn candid_path(&self) -> &Path
Return the exact verified local Candid sidecar admitted for transport.
Examples found in repository?
examples/empty_fleet_subnet_root_retirement.rs (line 243)
218fn invoke<I, O>(
219 icp: &IcpCli,
220 binding: &ResolvedProtocolBinding,
221 canister: Principal,
222 method: &str,
223 input: &I,
224 is_query: bool,
225) -> Result<O, Box<dyn std::error::Error>>
226where
227 I: CandidType,
228 O: CandidType + DeserializeOwned,
229{
230 let bytes = candid::encode_one(input)?;
231 let path = env::temp_dir().join(format!(
232 "canic-empty-root-retirement-{}-{}.bin",
233 std::process::id(),
234 method
235 ));
236 fs::write(&path, bytes)?;
237 let response = if is_query {
238 icp.canister_query_binary_args_output_with_candid(
239 &canister.to_text(),
240 method,
241 &path,
242 Some("json"),
243 Some(binding.candid_path()),
244 )
245 } else {
246 icp.canister_call_binary_args_output_with_candid(
247 &canister.to_text(),
248 method,
249 &path,
250 Some("json"),
251 Some(binding.candid_path()),
252 )
253 };
254 let cleanup = fs::remove_file(path);
255 let response = response?;
256 cleanup?;
257 Ok(decode_json_result_response(&response)?)
258}Trait Implementations§
Source§impl Clone for ResolvedProtocolBinding
impl Clone for ResolvedProtocolBinding
Source§fn clone(&self) -> ResolvedProtocolBinding
fn clone(&self) -> ResolvedProtocolBinding
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ResolvedProtocolBinding
impl Debug for ResolvedProtocolBinding
impl Eq for ResolvedProtocolBinding
Source§impl PartialEq for ResolvedProtocolBinding
impl PartialEq for ResolvedProtocolBinding
impl StructuralPartialEq for ResolvedProtocolBinding
Auto Trait Implementations§
impl Freeze for ResolvedProtocolBinding
impl RefUnwindSafe for ResolvedProtocolBinding
impl Send for ResolvedProtocolBinding
impl Sync for ResolvedProtocolBinding
impl Unpin for ResolvedProtocolBinding
impl UnsafeUnpin for ResolvedProtocolBinding
impl UnwindSafe for ResolvedProtocolBinding
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.