You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: str.rs
    path of file: ./repos/msgpack-rust/rmp/src/encode
    
    the code of the file until where you have to start completion: use super::{RmpWrite, write_marker};
use crate::encode::ValueWriteError;
use crate::Marker;

/// Encode
    
pub fn write_str_len<W: RmpWrite>(wr: &mut W, len: u32) -> Result<Marker, ValueWriteError<W::Error>> {
    if len < 32 {
        write_marker(wr, Marker::FixStr(len as u8))?;
        Ok(Marker::FixStr(len as u8))
    } else if len < 256 {
        write_marker(wr, Marker::Str8)?;
        wr.write_data_u8(len as u8)?;
        Ok(Marker::Str8)
    } else if len <= u16::MAX as u32 {
        write_marker(wr, Marker::Str16)?;
        wr.write_data_u16(len as u16)?;
        Ok(Marker::Str16)
    } else {
        write_marker(wr, Marker::Str32)?;
        wr.write_data_u32(len)?;
        Ok(Marker::Str32)
    }
}