MCPcopy Index your code
hub / github.com/RustPython/RustPython / b2a_base64

Function b2a_base64

crates/stdlib/src/binascii.rs:380–389  ·  view source on GitHub ↗
(data: ArgBytesLike, NewlineArg { newline }: NewlineArg)

Source from the content-addressed store, hash-verified

378
379 #[pyfunction]
380 fn b2a_base64(data: ArgBytesLike, NewlineArg { newline }: NewlineArg) -> Vec<u8> {
381 // https://stackoverflow.com/questions/63916821
382 let mut encoded = data
383 .with_ref(|b| base64::engine::general_purpose::STANDARD.encode(b))
384 .into_bytes();
385 if newline {
386 encoded.push(b'\n');
387 }
388 encoded
389 }
390
391 #[inline]
392 fn uu_a2b_read(c: &u8, vm: &VirtualMachine) -> PyResult<u8> {

Callers 1

body_encodeFunction · 0.90

Calls 4

with_refMethod · 0.80
into_bytesMethod · 0.45
encodeMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected