pub struct AeronUri<S: ResourceStorage<aeron_uri_t> = CResource<aeron_uri_t>> { /* private fields */ }Implementations§
Source§impl AeronUri<CResource<aeron_uri_t>>
impl AeronUri<CResource<aeron_uri_t>>
Sourcepub unsafe fn new(
mutable_uri: [c_char; 4096],
type_: aeron_uri_type_t,
params: aeron_uri_stct__bindgen_ty_1,
) -> Result<Self, AeronCError>
pub unsafe fn new( mutable_uri: [c_char; 4096], type_: aeron_uri_type_t, params: aeron_uri_stct__bindgen_ty_1, ) -> Result<Self, AeronCError>
§Safety
Pointer fields must refer to valid storage for every use of this struct.
Sourcepub unsafe fn new_zeroed_on_heap() -> Self
pub unsafe fn new_zeroed_on_heap() -> Self
Creates zeroed native storage on the heap.
§Safety
For handles with native methods, initialise the native state before calling those methods. Zeroed storage is not a connection.
Sourcepub unsafe fn new_zeroed_on_stack() -> AeronUri<Inline<aeron_uri_t>>
pub unsafe fn new_zeroed_on_stack() -> AeronUri<Inline<aeron_uri_t>>
Creates zeroed native storage inline.
§Safety
For handles with native methods, initialise the native state before calling those methods. Zeroed storage is not a connection.
Source§impl AeronUri
impl AeronUri
Sourcepub unsafe fn parse_params<AeronUriParseCallbackHandlerImpl: AeronUriParseCallbackCallback, AeronUriParseCallbackHandlerImplPolicy: CallbackPolicy>(
uri: *mut c_char,
param_func: &Handler<AeronUriParseCallbackHandlerImpl, AeronUriParseCallbackHandlerImplPolicy>,
) -> Result<i32, AeronCError>
pub unsafe fn parse_params<AeronUriParseCallbackHandlerImpl: AeronUriParseCallbackCallback, AeronUriParseCallbackHandlerImplPolicy: CallbackPolicy>( uri: *mut c_char, param_func: &Handler<AeronUriParseCallbackHandlerImpl, AeronUriParseCallbackHandlerImplPolicy>, ) -> Result<i32, AeronCError>
§Safety
Raw pointer arguments must have the size, alignment, initialization and lifetime required by the native function. Writable pointers require exclusive access. Keep any retained pointers valid until native cleanup.
Sourcepub unsafe fn parse_params_fn<AeronUriParseCallbackHandlerImpl: FnMut(&str, &str) -> c_int>(
uri: *mut c_char,
param_func: AeronUriParseCallbackHandlerImpl,
) -> Result<i32, AeronCError>
pub unsafe fn parse_params_fn<AeronUriParseCallbackHandlerImpl: FnMut(&str, &str) -> c_int>( uri: *mut c_char, param_func: AeronUriParseCallbackHandlerImpl, ) -> Result<i32, AeronCError>
§Safety
Raw pointer arguments must have the size, alignment, initialization and lifetime required by the native function. Writable pointers require exclusive access. Keep any retained pointers valid until native cleanup.
Stack-borrowed closure variant. The FnMut closure lives on the caller’s
stack and is borrowed for this call only. The callback fires synchronously,
so nothing is heap-allocated or stored and the closure may borrow local
state. Generated only for callbacks C does not retain. Prefer it to the
Handler form on the hot path
§Panics
A panic in the closure is caught so the C call can finish, then passed to the caller once it returns
pub fn parse_tag(tag_str: &CStr) -> i64
Source§impl<S: ResourceStorage<aeron_uri_t>> AeronUri<S>
impl<S: ResourceStorage<aeron_uri_t>> AeronUri<S>
pub fn mutable_uri(&self) -> [c_char; 4096]
pub fn type_(&self) -> aeron_uri_type_t
pub fn params(&self) -> aeron_uri_stct__bindgen_ty_1
pub fn multicast_ttl(&self) -> u8
pub fn sprint(&self, buffer: &mut [u8]) -> Result<i32, AeronCError>
pub fn sprint_as_string(&self, max_length: usize) -> Result<String, AeronCError>
Sourcepub fn sprint_into(
&self,
dst_truncate_to_capacity: &mut String,
) -> Result<i32, AeronCError>
pub fn sprint_into( &self, dst_truncate_to_capacity: &mut String, ) -> Result<i32, AeronCError>
NOTE: allocation friendly method, the string capacity must be set as it will truncate string to capacity it will never grow the string. So if you pass String::new() it will write 0 chars
pub fn get_inner(&self) -> *mut aeron_uri_t
Sourcepub unsafe fn get_inner_mut(&self) -> &mut aeron_uri_t
pub unsafe fn get_inner_mut(&self) -> &mut aeron_uri_t
Mutable access to the underlying C struct, minted from &self: nothing
prevents two live &mut at once, so the caller must ensure exclusive
access for the lifetime of the returned reference.
§Safety
No other reference (& or &mut) to the underlying struct may be
alive while the returned &mut is in use.
Sourcepub unsafe fn get_inner_ref(&self) -> &aeron_uri_t
pub unsafe fn get_inner_ref(&self) -> &aeron_uri_t
Borrow the native struct.
§Safety
No Rust or native call may mutate the struct while this reference is alive. Shared wrappers also require coordination with other threads.
Source§impl AeronUri
impl AeronUri
Sourcepub unsafe fn from_ptr(ptr: *mut aeron_uri_t) -> AeronUri<Borrowed<aeron_uri_t>>
pub unsafe fn from_ptr(ptr: *mut aeron_uri_t) -> AeronUri<Borrowed<aeron_uri_t>>
Borrow a native pointer without taking ownership.
§Safety
The pointer must be non-null. It and its parents must remain live for every use. Calls must follow Aeron’s threading and aliasing rules.
Sourcepub unsafe fn from_native(value: aeron_uri_t) -> AeronUri<Inline<aeron_uri_t>>
pub unsafe fn from_native(value: aeron_uri_t) -> AeronUri<Inline<aeron_uri_t>>
Copy a native struct into inline storage.
§Safety
Pointer fields must stay valid for every use of the returned handle.
Source§impl AeronUri
impl AeronUri
Sourcepub fn close(self) -> Result<(), AeronCError>
pub fn close(self) -> Result<(), AeronCError>
Releases this handle. Native cleanup waits for the last owning clone when the resource can be retained by another handle.
Source§impl<S: ResourceStorage<aeron_uri_t>> AeronUri<S>
impl<S: ResourceStorage<aeron_uri_t>> AeronUri<S>
Sourcepub unsafe fn clone_struct(&self) -> AeronUri<CResource<aeron_uri_t>>
pub unsafe fn clone_struct(&self) -> AeronUri<CResource<aeron_uri_t>>
Copies the underlying struct into a new heap allocation
Only for plain data structs with no init or clean-up functions, so not for Aeron, AeronContext, AeronPublication or AeronSubscription
§Safety
This is a shallow copy, not a new native resource. Pointers inside unions, arrays and nested structs are copied too. Keep their targets alive for every use of the copy. Coordinate writes through aliases, and do not use the copy to release or reinitialize shared native state. No Rust or native write may overlap copying the source struct. Callback storage expires when its callback returns. Copy individual fields into Rust values when you need an independent snapshot.