MCPcopy Index your code
hub / github.com/endbasic/endbasic / get

Method get

repl/src/demos.rs:144–153  ·  view source on GitHub ↗
(&self, name: &str)

Source from the content-addressed store, hash-verified

142 }
143
144 async fn get(&self, name: &str) -> io::Result<Vec<u8>> {
145 let uc_name = name.to_ascii_uppercase();
146 match self.demos.get(&uc_name.as_ref()) {
147 Some(value) => {
148 let (_metadata, content) = value;
149 Ok(content.as_bytes().to_owned())
150 }
151 None => Err(io::Error::new(io::ErrorKind::NotFound, "Demo not found")),
152 }
153 }
154
155 async fn put(&mut self, _name: &str, _content: &[u8]) -> io::Result<()> {
156 Err(io::Error::new(io::ErrorKind::PermissionDenied, "The demos drive is read-only"))

Callers 4

setupMethod · 0.45
readMethod · 0.45
try_load_autoexecFunction · 0.45
run_from_storage_pathFunction · 0.45

Calls 1

as_bytesMethod · 0.80

Tested by

no test coverage detected