mirror of
https://github.com/YGGverse/ggemini.git
synced 2026-04-02 18:15:37 +00:00
update comments
This commit is contained in:
parent
7d837c552b
commit
a0827e0425
1 changed files with 3 additions and 1 deletions
|
|
@ -34,10 +34,12 @@ impl Meta {
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
/// Create new `Self` from UTF-8 buffer
|
/// Create new `Self` from UTF-8 buffer
|
||||||
|
/// * supports entire response or just meta slice
|
||||||
pub fn from_utf8(buffer: &[u8]) -> Result<Self, (Error, Option<&str>)> {
|
pub fn from_utf8(buffer: &[u8]) -> Result<Self, (Error, Option<&str>)> {
|
||||||
|
// Calculate buffer length once
|
||||||
let len = buffer.len();
|
let len = buffer.len();
|
||||||
|
|
||||||
// Can parse from entire response or just meta buffer given
|
// Parse meta bytes only
|
||||||
match buffer.get(..if len > MAX_LEN { MAX_LEN } else { len }) {
|
match buffer.get(..if len > MAX_LEN { MAX_LEN } else { len }) {
|
||||||
Some(slice) => {
|
Some(slice) => {
|
||||||
// Parse data
|
// Parse data
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue