如果我不知道如何获取WIPOffset对象,该如何构造PlasmaContainsRequest?

时间:2019-03-03 16:10:50

标签: rust flatbuffers

由于我不知道如何获取PlasmaContainsRequest对象来构造WIPOffset对象,因此如何构造PlasmaContainsRequestArgs对象?

我使用flatc 1.10.0生成了这个Rust代码:

impl<'a> PlasmaContainsRequest<'a> {
    #[inline]
    pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
        PlasmaContainsRequest { _tab: table }
    }
    #[allow(unused_mut)]
    pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
        _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
        args: &'args PlasmaContainsRequestArgs<'args>,
    ) -> flatbuffers::WIPOffset<PlasmaContainsRequest<'bldr>> {
        let mut builder = PlasmaContainsRequestBuilder::new(_fbb);
        if let Some(x) = args.object_id {
            builder.add_object_id(x);
        }
        builder.finish()
    }

    pub const VT_OBJECT_ID: flatbuffers::VOffsetT = 4;

    #[inline]
    pub fn object_id(&self) -> Option<&'a str> {
        self._tab
            .get::<flatbuffers::ForwardsUOffset<&str>>(PlasmaContainsRequest::VT_OBJECT_ID, None)
    }
}

pub struct PlasmaContainsRequestArgs<'a> {
    pub object_id: Option<flatbuffers::WIPOffset<&'a str>>,
}
impl<'a> Default for PlasmaContainsRequestArgs<'a> {
    #[inline]
    fn default() -> Self {
        PlasmaContainsRequestArgs { object_id: None }
    }
}

0 个答案:

没有答案