mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-28 19:30:02 +00:00
fix(idl_gen_rust): Fix lifetime warning added in Rust 1.89 (#8709)
Rust 1.89 added a new lifetime-related warning: <https://blog.rust-lang.org/2025/08/07/Rust-1.89.0/#mismatched-lifetime-syntaxes-lint> The Rust code generator currently emits code which trips this warning. This very small PR fixes the issue for the relevant generated functions and for the Rust flexbuffers code. Fixes #8705
This commit is contained in:
@@ -149,7 +149,7 @@ impl ArrayTableT {
|
||||
/// catch every error, or be maximally performant. For the
|
||||
/// previous, unchecked, behavior use
|
||||
/// `root_as_array_table_unchecked`.
|
||||
pub fn root_as_array_table(buf: &[u8]) -> Result<ArrayTable, flatbuffers::InvalidFlatbuffer> {
|
||||
pub fn root_as_array_table(buf: &[u8]) -> Result<ArrayTable<'_>, flatbuffers::InvalidFlatbuffer> {
|
||||
flatbuffers::root::<ArrayTable>(buf)
|
||||
}
|
||||
#[inline]
|
||||
@@ -159,7 +159,7 @@ pub fn root_as_array_table(buf: &[u8]) -> Result<ArrayTable, flatbuffers::Invali
|
||||
/// catch every error, or be maximally performant. For the
|
||||
/// previous, unchecked, behavior use
|
||||
/// `size_prefixed_root_as_array_table_unchecked`.
|
||||
pub fn size_prefixed_root_as_array_table(buf: &[u8]) -> Result<ArrayTable, flatbuffers::InvalidFlatbuffer> {
|
||||
pub fn size_prefixed_root_as_array_table(buf: &[u8]) -> Result<ArrayTable<'_>, flatbuffers::InvalidFlatbuffer> {
|
||||
flatbuffers::size_prefixed_root::<ArrayTable>(buf)
|
||||
}
|
||||
#[inline]
|
||||
@@ -192,14 +192,14 @@ pub fn size_prefixed_root_as_array_table_with_opts<'b, 'o>(
|
||||
/// Assumes, without verification, that a buffer of bytes contains a ArrayTable and returns it.
|
||||
/// # Safety
|
||||
/// Callers must trust the given bytes do indeed contain a valid `ArrayTable`.
|
||||
pub unsafe fn root_as_array_table_unchecked(buf: &[u8]) -> ArrayTable {
|
||||
pub unsafe fn root_as_array_table_unchecked(buf: &[u8]) -> ArrayTable<'_> {
|
||||
unsafe { flatbuffers::root_unchecked::<ArrayTable>(buf) }
|
||||
}
|
||||
#[inline]
|
||||
/// Assumes, without verification, that a buffer of bytes contains a size prefixed ArrayTable and returns it.
|
||||
/// # Safety
|
||||
/// Callers must trust the given bytes do indeed contain a valid size prefixed `ArrayTable`.
|
||||
pub unsafe fn size_prefixed_root_as_array_table_unchecked(buf: &[u8]) -> ArrayTable {
|
||||
pub unsafe fn size_prefixed_root_as_array_table_unchecked(buf: &[u8]) -> ArrayTable<'_> {
|
||||
unsafe { flatbuffers::size_prefixed_root_unchecked::<ArrayTable>(buf) }
|
||||
}
|
||||
pub const ARRAY_TABLE_IDENTIFIER: &str = "ARRT";
|
||||
|
||||
@@ -1935,7 +1935,7 @@ impl MonsterT {
|
||||
/// catch every error, or be maximally performant. For the
|
||||
/// previous, unchecked, behavior use
|
||||
/// `root_as_monster_unchecked`.
|
||||
pub fn root_as_monster(buf: &[u8]) -> Result<Monster, flatbuffers::InvalidFlatbuffer> {
|
||||
pub fn root_as_monster(buf: &[u8]) -> Result<Monster<'_>, flatbuffers::InvalidFlatbuffer> {
|
||||
flatbuffers::root::<Monster>(buf)
|
||||
}
|
||||
#[inline]
|
||||
@@ -1945,7 +1945,7 @@ pub fn root_as_monster(buf: &[u8]) -> Result<Monster, flatbuffers::InvalidFlatbu
|
||||
/// catch every error, or be maximally performant. For the
|
||||
/// previous, unchecked, behavior use
|
||||
/// `size_prefixed_root_as_monster_unchecked`.
|
||||
pub fn size_prefixed_root_as_monster(buf: &[u8]) -> Result<Monster, flatbuffers::InvalidFlatbuffer> {
|
||||
pub fn size_prefixed_root_as_monster(buf: &[u8]) -> Result<Monster<'_>, flatbuffers::InvalidFlatbuffer> {
|
||||
flatbuffers::size_prefixed_root::<Monster>(buf)
|
||||
}
|
||||
#[inline]
|
||||
@@ -1978,14 +1978,14 @@ pub fn size_prefixed_root_as_monster_with_opts<'b, 'o>(
|
||||
/// Assumes, without verification, that a buffer of bytes contains a Monster and returns it.
|
||||
/// # Safety
|
||||
/// Callers must trust the given bytes do indeed contain a valid `Monster`.
|
||||
pub unsafe fn root_as_monster_unchecked(buf: &[u8]) -> Monster {
|
||||
pub unsafe fn root_as_monster_unchecked(buf: &[u8]) -> Monster<'_> {
|
||||
unsafe { flatbuffers::root_unchecked::<Monster>(buf) }
|
||||
}
|
||||
#[inline]
|
||||
/// Assumes, without verification, that a buffer of bytes contains a size prefixed Monster and returns it.
|
||||
/// # Safety
|
||||
/// Callers must trust the given bytes do indeed contain a valid size prefixed `Monster`.
|
||||
pub unsafe fn size_prefixed_root_as_monster_unchecked(buf: &[u8]) -> Monster {
|
||||
pub unsafe fn size_prefixed_root_as_monster_unchecked(buf: &[u8]) -> Monster<'_> {
|
||||
unsafe { flatbuffers::size_prefixed_root_unchecked::<Monster>(buf) }
|
||||
}
|
||||
pub const MONSTER_IDENTIFIER: &str = "MONS";
|
||||
|
||||
@@ -2162,7 +2162,7 @@ impl MonsterT {
|
||||
/// catch every error, or be maximally performant. For the
|
||||
/// previous, unchecked, behavior use
|
||||
/// `root_as_monster_unchecked`.
|
||||
pub fn root_as_monster(buf: &[u8]) -> Result<Monster, flatbuffers::InvalidFlatbuffer> {
|
||||
pub fn root_as_monster(buf: &[u8]) -> Result<Monster<'_>, flatbuffers::InvalidFlatbuffer> {
|
||||
flatbuffers::root::<Monster>(buf)
|
||||
}
|
||||
#[inline]
|
||||
@@ -2172,7 +2172,7 @@ pub fn root_as_monster(buf: &[u8]) -> Result<Monster, flatbuffers::InvalidFlatbu
|
||||
/// catch every error, or be maximally performant. For the
|
||||
/// previous, unchecked, behavior use
|
||||
/// `size_prefixed_root_as_monster_unchecked`.
|
||||
pub fn size_prefixed_root_as_monster(buf: &[u8]) -> Result<Monster, flatbuffers::InvalidFlatbuffer> {
|
||||
pub fn size_prefixed_root_as_monster(buf: &[u8]) -> Result<Monster<'_>, flatbuffers::InvalidFlatbuffer> {
|
||||
flatbuffers::size_prefixed_root::<Monster>(buf)
|
||||
}
|
||||
#[inline]
|
||||
@@ -2205,14 +2205,14 @@ pub fn size_prefixed_root_as_monster_with_opts<'b, 'o>(
|
||||
/// Assumes, without verification, that a buffer of bytes contains a Monster and returns it.
|
||||
/// # Safety
|
||||
/// Callers must trust the given bytes do indeed contain a valid `Monster`.
|
||||
pub unsafe fn root_as_monster_unchecked(buf: &[u8]) -> Monster {
|
||||
pub unsafe fn root_as_monster_unchecked(buf: &[u8]) -> Monster<'_> {
|
||||
unsafe { flatbuffers::root_unchecked::<Monster>(buf) }
|
||||
}
|
||||
#[inline]
|
||||
/// Assumes, without verification, that a buffer of bytes contains a size prefixed Monster and returns it.
|
||||
/// # Safety
|
||||
/// Callers must trust the given bytes do indeed contain a valid size prefixed `Monster`.
|
||||
pub unsafe fn size_prefixed_root_as_monster_unchecked(buf: &[u8]) -> Monster {
|
||||
pub unsafe fn size_prefixed_root_as_monster_unchecked(buf: &[u8]) -> Monster<'_> {
|
||||
unsafe { flatbuffers::size_prefixed_root_unchecked::<Monster>(buf) }
|
||||
}
|
||||
pub const MONSTER_IDENTIFIER: &str = "MONS";
|
||||
|
||||
@@ -951,7 +951,7 @@ impl ScalarStuffT {
|
||||
/// catch every error, or be maximally performant. For the
|
||||
/// previous, unchecked, behavior use
|
||||
/// `root_as_scalar_stuff_unchecked`.
|
||||
pub fn root_as_scalar_stuff(buf: &[u8]) -> Result<ScalarStuff, flatbuffers::InvalidFlatbuffer> {
|
||||
pub fn root_as_scalar_stuff(buf: &[u8]) -> Result<ScalarStuff<'_>, flatbuffers::InvalidFlatbuffer> {
|
||||
flatbuffers::root::<ScalarStuff>(buf)
|
||||
}
|
||||
#[inline]
|
||||
@@ -961,7 +961,7 @@ pub fn root_as_scalar_stuff(buf: &[u8]) -> Result<ScalarStuff, flatbuffers::Inva
|
||||
/// catch every error, or be maximally performant. For the
|
||||
/// previous, unchecked, behavior use
|
||||
/// `size_prefixed_root_as_scalar_stuff_unchecked`.
|
||||
pub fn size_prefixed_root_as_scalar_stuff(buf: &[u8]) -> Result<ScalarStuff, flatbuffers::InvalidFlatbuffer> {
|
||||
pub fn size_prefixed_root_as_scalar_stuff(buf: &[u8]) -> Result<ScalarStuff<'_>, flatbuffers::InvalidFlatbuffer> {
|
||||
flatbuffers::size_prefixed_root::<ScalarStuff>(buf)
|
||||
}
|
||||
#[inline]
|
||||
@@ -994,14 +994,14 @@ pub fn size_prefixed_root_as_scalar_stuff_with_opts<'b, 'o>(
|
||||
/// Assumes, without verification, that a buffer of bytes contains a ScalarStuff and returns it.
|
||||
/// # Safety
|
||||
/// Callers must trust the given bytes do indeed contain a valid `ScalarStuff`.
|
||||
pub unsafe fn root_as_scalar_stuff_unchecked(buf: &[u8]) -> ScalarStuff {
|
||||
pub unsafe fn root_as_scalar_stuff_unchecked(buf: &[u8]) -> ScalarStuff<'_> {
|
||||
unsafe { flatbuffers::root_unchecked::<ScalarStuff>(buf) }
|
||||
}
|
||||
#[inline]
|
||||
/// Assumes, without verification, that a buffer of bytes contains a size prefixed ScalarStuff and returns it.
|
||||
/// # Safety
|
||||
/// Callers must trust the given bytes do indeed contain a valid size prefixed `ScalarStuff`.
|
||||
pub unsafe fn size_prefixed_root_as_scalar_stuff_unchecked(buf: &[u8]) -> ScalarStuff {
|
||||
pub unsafe fn size_prefixed_root_as_scalar_stuff_unchecked(buf: &[u8]) -> ScalarStuff<'_> {
|
||||
unsafe { flatbuffers::size_prefixed_root_unchecked::<ScalarStuff>(buf) }
|
||||
}
|
||||
pub const SCALAR_STUFF_IDENTIFIER: &str = "NULL";
|
||||
|
||||
Reference in New Issue
Block a user