MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / copy_to_bytes

Method copy_to_bytes

src/ore/src/bytes.rs:174–191  ·  view source on GitHub ↗
(&mut self, len: usize)

Source from the content-addressed store, hash-verified

172 }
173
174 fn copy_to_bytes(&mut self, len: usize) -> Bytes {
175 // If possible, use the zero-copy implementation on individual segments.
176 if let Some((seg, _len)) = self.segments.first_mut() {
177 if len <= seg.len() {
178 self.len -= len;
179 return seg.copy_to_bytes(len);
180 }
181 }
182 // Otherwise, fall back to a generic implementation.
183 assert!(
184 len <= self.len(),
185 "tried to copy {len} bytes with {} remaining",
186 self.len()
187 );
188 let mut out = BytesMut::with_capacity(len);
189 out.put(self.take(len));
190 out.freeze()
191 }
192}
193
194#[cfg(feature = "parquet")]

Callers 3

into_contiguousMethod · 0.80
get_bytesMethod · 0.80
testFunction · 0.80

Calls 3

putMethod · 0.80
lenMethod · 0.45
takeMethod · 0.45

Tested by

no test coverage detected