A struct may hold references, and then it needs a lifetime parameter:
struct Frame<'a> {
method: &'a str,
params: &'a str,
}
The parameter is a promise: an instance of Frame may not outlive the buffer it points into. The compiler enforces it, so the struct can never be left holding a dangling pointer into a freed allocation.
This is the shape of every zero-copy parser. Instead of allocating a String per field, you hand out slices of a buffer someone else owns.
