pub fn validate_capability_gate(
config: &AsupersyncConfig,
required: CapabilitySet,
) -> Result<(), AsupersyncError>Examples found in repository?
examples/transport_receive_ab.rs (line 93)
92 fn store(&self, artifact: EncodedArtifact, config: &AsupersyncConfig) {
93 validate_capability_gate(config, Self::required_capabilities()).expect("capability gate");
94 self.storage
95 .lock()
96 .expect("legacy transport lock")
97 .insert(artifact.artifact_id.clone(), artifact);
98 }
99
100 fn receive(
101 &self,
102 artifact_id: &str,
103 config: &AsupersyncConfig,
104 ) -> Result<EncodedArtifact, AsupersyncError> {
105 validate_capability_gate(config, Self::required_capabilities())?;
106 let guard = self.storage.lock().map_err(|_| {
107 AsupersyncError::Transport("in-memory transport lock poisoned".to_string())
108 })?;
109 // THE CONTROL'S DEFINING PROPERTY: the deep clone is inside the guard.
110 guard
111 .get(artifact_id)
112 .cloned()
113 .ok_or_else(|| AsupersyncError::ArtifactNotFound(artifact_id.to_string()))
114 }