summaryrefslogtreecommitdiff
path: root/tests/namespace_test/namespace_test2_generated.rs
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2018-09-28 21:11:05 -0600
committerRobert <rw@users.noreply.github.com>2018-09-28 20:11:05 -0700
commitbf871ffd7f910601483b4eec5e4fbeb29f29a17b (patch)
tree159cd31b754852227a38d1c2c8648c13d3bacb5c /tests/namespace_test/namespace_test2_generated.rs
parenta89be8739c462b47d59e1364e3e2dc8096806400 (diff)
downloadflatbuffers-bf871ffd7f910601483b4eec5e4fbeb29f29a17b.tar.gz
flatbuffers-bf871ffd7f910601483b4eec5e4fbeb29f29a17b.tar.bz2
flatbuffers-bf871ffd7f910601483b4eec5e4fbeb29f29a17b.zip
Remove lifetime specifier on table getter methods (#4949)
With the old-style code, the test fails with a borrow-checker error: ``` #[inline] pub fn name(&'a self) -> &'a str { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Monster::VT_NAME, None).unwrap() } ``` ``` error[E0597]: `e` does not live long enough --> tests/integration_test.rs:273:57 | 273 | let enemy_of_my_enemy = monster.enemy().map(|e| e.name()); | ^ - `e` dropped here while still borrowed | | | borrowed value does not live long enough 274 | assert_eq!(enemy_of_my_enemy, Some("Fred")); 275 | } | - borrowed value needs to live until here ```
Diffstat (limited to 'tests/namespace_test/namespace_test2_generated.rs')
-rw-r--r--tests/namespace_test/namespace_test2_generated.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/namespace_test/namespace_test2_generated.rs b/tests/namespace_test/namespace_test2_generated.rs
index e420b899..f748a08d 100644
--- a/tests/namespace_test/namespace_test2_generated.rs
+++ b/tests/namespace_test/namespace_test2_generated.rs
@@ -55,15 +55,15 @@ impl<'a> TableInFirstNS<'a> {
pub const VT_FOO_STRUCT: flatbuffers::VOffsetT = 8;
#[inline]
- pub fn foo_table(&'a self) -> Option<namespace_b::TableInNestedNS<'a>> {
+ pub fn foo_table(&self) -> Option<namespace_b::TableInNestedNS<'a>> {
self._tab.get::<flatbuffers::ForwardsUOffset<namespace_b::TableInNestedNS<'a>>>(TableInFirstNS::VT_FOO_TABLE, None)
}
#[inline]
- pub fn foo_enum(&'a self) -> namespace_b::EnumInNestedNS {
+ pub fn foo_enum(&self) -> namespace_b::EnumInNestedNS {
self._tab.get::<namespace_b::EnumInNestedNS>(TableInFirstNS::VT_FOO_ENUM, Some(namespace_b::EnumInNestedNS::A)).unwrap()
}
#[inline]
- pub fn foo_struct(&'a self) -> Option<&'a namespace_b::StructInNestedNS> {
+ pub fn foo_struct(&self) -> Option<&'a namespace_b::StructInNestedNS> {
self._tab.get::<namespace_b::StructInNestedNS>(TableInFirstNS::VT_FOO_STRUCT, None)
}
}
@@ -151,7 +151,7 @@ impl<'a> SecondTableInA<'a> {
pub const VT_REFER_TO_C: flatbuffers::VOffsetT = 4;
#[inline]
- pub fn refer_to_c(&'a self) -> Option<super::namespace_c::TableInC<'a>> {
+ pub fn refer_to_c(&self) -> Option<super::namespace_c::TableInC<'a>> {
self._tab.get::<flatbuffers::ForwardsUOffset<super::namespace_c::TableInC<'a>>>(SecondTableInA::VT_REFER_TO_C, None)
}
}
@@ -241,11 +241,11 @@ impl<'a> TableInC<'a> {
pub const VT_REFER_TO_A2: flatbuffers::VOffsetT = 6;
#[inline]
- pub fn refer_to_a1(&'a self) -> Option<super::namespace_a::TableInFirstNS<'a>> {
+ pub fn refer_to_a1(&self) -> Option<super::namespace_a::TableInFirstNS<'a>> {
self._tab.get::<flatbuffers::ForwardsUOffset<super::namespace_a::TableInFirstNS<'a>>>(TableInC::VT_REFER_TO_A1, None)
}
#[inline]
- pub fn refer_to_a2(&'a self) -> Option<super::namespace_a::SecondTableInA<'a>> {
+ pub fn refer_to_a2(&self) -> Option<super::namespace_a::SecondTableInA<'a>> {
self._tab.get::<flatbuffers::ForwardsUOffset<super::namespace_a::SecondTableInA<'a>>>(TableInC::VT_REFER_TO_A2, None)
}
}