feat(hyperhdr): vendor the flatbuffers schemas and generated bindings

The .fbs files come from HyperHDR (see schema/NOTICE); the *_generated.rs
files are flatc output regenerated by scripts/regen-fbs.sh, which refuses to
run unless flatc matches the pinned flatbuffers crate.
This commit is contained in:
2026-09-12 10:08:56 +03:00
parent 623fab55e5
commit 617296afae
9 changed files with 1911 additions and 0 deletions
@@ -0,0 +1,242 @@
// automatically generated by the FlatBuffers compiler, do not modify
// @generated
extern crate alloc;
#[allow(unused_imports, dead_code)]
pub mod hyperhdrnet {
extern crate alloc;
pub enum ReplyOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Reply<'a> {
pub _tab: ::flatbuffers::Table<'a>,
}
impl<'a> ::flatbuffers::Follow<'a> for Reply<'a> {
type Inner = Reply<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self {
_tab: unsafe { ::flatbuffers::Table::new(buf, loc) },
}
}
}
impl<'a> Reply<'a> {
pub const VT_ERROR: ::flatbuffers::VOffsetT = 4;
pub const VT_VIDEO: ::flatbuffers::VOffsetT = 6;
pub const VT_REGISTERED: ::flatbuffers::VOffsetT = 8;
#[inline]
pub unsafe fn init_from_table(table: ::flatbuffers::Table<'a>) -> Self {
Reply { _tab: table }
}
#[allow(unused_mut)]
pub fn create<
'bldr: 'args,
'args: 'mut_bldr,
'mut_bldr,
A: ::flatbuffers::Allocator + 'bldr,
>(
_fbb: &'mut_bldr mut ::flatbuffers::FlatBufferBuilder<'bldr, A>,
args: &'args ReplyArgs<'args>,
) -> ::flatbuffers::WIPOffset<Reply<'bldr>> {
let mut builder = ReplyBuilder::new(_fbb);
builder.add_registered(args.registered);
builder.add_video(args.video);
if let Some(x) = args.error {
builder.add_error(x);
}
builder.finish()
}
#[inline]
pub fn error(&self) -> Option<&'a str> {
// Safety:
// Created from valid Table for this object
// which contains a valid value in this slot
unsafe {
self._tab
.get::<::flatbuffers::ForwardsUOffset<&str>>(Reply::VT_ERROR, None)
}
}
#[inline]
pub fn video(&self) -> i32 {
// Safety:
// Created from valid Table for this object
// which contains a valid value in this slot
unsafe { self._tab.get::<i32>(Reply::VT_VIDEO, Some(-1)).unwrap() }
}
#[inline]
pub fn registered(&self) -> i32 {
// Safety:
// Created from valid Table for this object
// which contains a valid value in this slot
unsafe {
self._tab
.get::<i32>(Reply::VT_REGISTERED, Some(-1))
.unwrap()
}
}
}
impl ::flatbuffers::Verifiable for Reply<'_> {
#[inline]
fn run_verifier(
v: &mut ::flatbuffers::Verifier,
pos: usize,
) -> Result<(), ::flatbuffers::InvalidFlatbuffer> {
v.visit_table(pos)?
.visit_field::<::flatbuffers::ForwardsUOffset<&str>>(
"error",
Self::VT_ERROR,
false,
)?
.visit_field::<i32>("video", Self::VT_VIDEO, false)?
.visit_field::<i32>("registered", Self::VT_REGISTERED, false)?
.finish();
Ok(())
}
}
pub struct ReplyArgs<'a> {
pub error: Option<::flatbuffers::WIPOffset<&'a str>>,
pub video: i32,
pub registered: i32,
}
impl<'a> Default for ReplyArgs<'a> {
#[inline]
fn default() -> Self {
ReplyArgs {
error: None,
video: -1,
registered: -1,
}
}
}
pub struct ReplyBuilder<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> {
fbb_: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
start_: ::flatbuffers::WIPOffset<::flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: ::flatbuffers::Allocator + 'a> ReplyBuilder<'a, 'b, A> {
#[inline]
pub fn add_error(&mut self, error: ::flatbuffers::WIPOffset<&'b str>) {
self.fbb_
.push_slot_always::<::flatbuffers::WIPOffset<_>>(Reply::VT_ERROR, error);
}
#[inline]
pub fn add_video(&mut self, video: i32) {
self.fbb_.push_slot::<i32>(Reply::VT_VIDEO, video, -1);
}
#[inline]
pub fn add_registered(&mut self, registered: i32) {
self.fbb_
.push_slot::<i32>(Reply::VT_REGISTERED, registered, -1);
}
#[inline]
pub fn new(
_fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
) -> ReplyBuilder<'a, 'b, A> {
let start = _fbb.start_table();
ReplyBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> ::flatbuffers::WIPOffset<Reply<'a>> {
let o = self.fbb_.end_table(self.start_);
::flatbuffers::WIPOffset::new(o.value())
}
}
impl ::core::fmt::Debug for Reply<'_> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
let mut ds = f.debug_struct("Reply");
ds.field("error", &self.error());
ds.field("video", &self.video());
ds.field("registered", &self.registered());
ds.finish()
}
}
#[inline]
/// Verifies that a buffer of bytes contains a `Reply`
/// and returns it.
/// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `root_as_reply_unchecked`.
pub fn root_as_reply(buf: &[u8]) -> Result<Reply<'_>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::root::<Reply>(buf)
}
#[inline]
/// Verifies that a buffer of bytes contains a size prefixed
/// `Reply` and returns it.
/// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `size_prefixed_root_as_reply_unchecked`.
pub fn size_prefixed_root_as_reply(
buf: &[u8],
) -> Result<Reply<'_>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::size_prefixed_root::<Reply>(buf)
}
#[inline]
/// Verifies, with the given options, that a buffer of bytes
/// contains a `Reply` and returns it.
/// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `root_as_reply_unchecked`.
pub fn root_as_reply_with_opts<'b, 'o>(
opts: &'o ::flatbuffers::VerifierOptions,
buf: &'b [u8],
) -> Result<Reply<'b>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::root_with_opts::<Reply<'b>>(opts, buf)
}
#[inline]
/// Verifies, with the given verifier options, that a buffer of
/// bytes contains a size prefixed `Reply` and returns
/// it. Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `root_as_reply_unchecked`.
pub fn size_prefixed_root_as_reply_with_opts<'b, 'o>(
opts: &'o ::flatbuffers::VerifierOptions,
buf: &'b [u8],
) -> Result<Reply<'b>, ::flatbuffers::InvalidFlatbuffer> {
::flatbuffers::size_prefixed_root_with_opts::<Reply<'b>>(opts, buf)
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a Reply and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid `Reply`.
pub unsafe fn root_as_reply_unchecked(buf: &[u8]) -> Reply<'_> {
unsafe { ::flatbuffers::root_unchecked::<Reply>(buf) }
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a size prefixed Reply and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid size prefixed `Reply`.
pub unsafe fn size_prefixed_root_as_reply_unchecked(buf: &[u8]) -> Reply<'_> {
unsafe { ::flatbuffers::size_prefixed_root_unchecked::<Reply>(buf) }
}
#[inline]
pub fn finish_reply_buffer<'a, 'b, A: ::flatbuffers::Allocator + 'a>(
fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
root: ::flatbuffers::WIPOffset<Reply<'a>>,
) {
fbb.finish(root, None);
}
#[inline]
pub fn finish_size_prefixed_reply_buffer<'a, 'b, A: ::flatbuffers::Allocator + 'a>(
fbb: &'b mut ::flatbuffers::FlatBufferBuilder<'a, A>,
root: ::flatbuffers::WIPOffset<Reply<'a>>,
) {
fbb.finish_size_prefixed(root, None);
}
} // pub mod hyperhdrnet
File diff suppressed because it is too large Load Diff
+22
View File
@@ -0,0 +1,22 @@
//! Code generated by `flatc --rust` from `schema/*.fbs` (see `scripts/regen-fbs.sh`).
//! Only this file is hand-written.
#![allow(
clippy::all,
dead_code,
unused_imports,
non_camel_case_types,
non_snake_case,
unsafe_op_in_unsafe_fn
)]
mod hyperhdr_reply_generated;
mod hyperhdr_request_generated;
pub mod request {
pub use super::hyperhdr_request_generated::hyperhdrnet::*;
}
pub mod reply {
pub use super::hyperhdr_reply_generated::hyperhdrnet::*;
}
+3
View File
@@ -0,0 +1,3 @@
//! Client for the HyperHDR flatbuffers server.
pub mod generated;
+4
View File
@@ -0,0 +1,4 @@
//! Captures gamescope's PipeWire stream at a small `requested_size` and forwards it to
//! HyperHDR's flatbuffers server.
pub mod hyperhdr;