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: advancement_update_s2c.rs
    path of file: ./repos/valence/crates/valence_protocol/src/packets/play
    
    the code of the file until where you have to start completion: // TODO: simplify this and bound packet fields where appropriate.

use std::borrow::Cow;
use std::io::Write;

use valence_ident::Ident;
use valence_text::Text;

use crate::{pack
    
    fn encode(&self, mut w: impl Write) -> anyhow::Result<()> {
        self.title.encode(&mut w)?;
        self.description.encode(&mut w)?;
        self.icon.encode(&mut w)?;
        self.frame_type.encode(&mut w)?;
        self.flags.encode(&mut w)?;

        match self.background_texture.as_ref() {
            None => {}
            Some(texture) => texture.encode(&mut w)?,
        }

        self.x_coord.encode(&mut w)?;
        self.y_coord.encode(&mut w)?;

        Ok(())
    }