use crate::{Error, Marker, WriteBuffer};

/// Encode a terminator marker for flexible containers.
pub fn write_terminator(buf: &mut WriteBuffer) -> Result<Marker, Error> {
    buf.write(1, |buf| {
        // Safety: 1 byte available in buf.
        unsafe { *buf.as_mut_ptr() = Marker::Term.encoding() }
    })?;

    Ok(Marker::Term)
}
