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: parse_object.rs
    path of file: ./repos/pdf/pdf/src/parser
    
    the code of the file until where you have to start completion: // Considering whether to impl Object and IndirectObject here.
//

use crate::parser::{lexer::*, MAX_DEPTH};
use crate::error::*;
use crate::primitive::{Primitive, PdfStream};
use crate::parser::{parse_with_lexer_ctx, parse_stream_with_lexer, Context, ParseFlags};
use crate::object::*;
use crate::crypt::Decoder;

/// Parses
    
pub fn parse_indirect_object(lexer: &mut Lexer, r: &impl Resolve, decoder: Option<&Decoder>, flags: ParseFlags) -> Result<(PlainRef, Primitive)> {
    let id = PlainRef {
        id: t!(lexer.next()).to::<ObjNr>()?,
        gen: t!(lexer.next()).to::<GenNr>()?,
    };
    lexer.next_expect("obj")?;

    let ctx = Context {
        decoder,
        id,
    };
    let obj = t!(parse_with_lexer_ctx(lexer, r, Some(&ctx), flags, MAX_DEPTH));

    if r.options().allow_missing_endobj {
        let pos = lexer.get_pos();
        if let Err(e) = lexer.next_expect("endobj") {
            warn!("error parsing obj {} {}: {:?}", id.id, id.gen, e);
            lexer.set_pos(pos);
        }
    } else {
        t!(lexer.next_expect("endobj"));
    }

    Ok((id, obj))
}