pub struct TestBackendEmission {
pub setup_block: String,
pub arg_expr: String,
pub type_imports: Vec<String>,
pub teardown_block: String,
}Expand description
Emission result for a test backend stub.
There is deliberately no “nothing emitted” constructor and no Default impl:
every TestBackendEmission a caller obtains must carry a real, compilable stub.
A language or configuration that cannot produce one panics before a value is
ever returned (see emit_test_backend and each per-language emitter) rather
than handing back a placeholder callers must remember to check. ~keep
Fields§
§setup_block: StringCode emitted at the top of the test function: stub class/struct definition.
arg_expr: StringExpression passed as the register_X arg: stub instance or Bridge-wrapped instance.
type_imports: Vec<String>Short symbol names that must be imported at the file or function scope
for the generated stub to compile. Rust backend populates this with
the trait name and any named return/parameter types so that callers can
emit the appropriate use module::Symbol; statements. Other language
backends leave this empty — they manage imports internally.
teardown_block: StringOptional teardown statements emitted after the fixture call and its
assertions, used to undo registry mutations performed by trait-bridge
fixtures (e.g. unregister_ocr_backend("test-backend")).
Test runners that share a process across tests (python pytest, ruby
rspec, dart test, etc.) leak registered test backends into later
tests; without a teardown the next OCR-using fixture fails because the
global registry contains only test-backend and the core’s
ensure_ocr_backends_initialized self-heal only triggers when the
registry is empty. Emitting unregister_<trait>(<name>) here drains
the test backend so the next access re-seeds the defaults.
Languages that run each test in its own process (Rust cargo integration tests, Go) leave this empty.
Trait Implementations§
Source§impl Clone for TestBackendEmission
impl Clone for TestBackendEmission
Source§fn clone(&self) -> TestBackendEmission
fn clone(&self) -> TestBackendEmission
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for TestBackendEmission
impl RefUnwindSafe for TestBackendEmission
impl Send for TestBackendEmission
impl Sync for TestBackendEmission
impl Unpin for TestBackendEmission
impl UnsafeUnpin for TestBackendEmission
impl UnwindSafe for TestBackendEmission
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more