Skip to main content

AddressInfoCollection

Trait AddressInfoCollection 

Source
pub trait AddressInfoCollection:
    Send
    + Sync
    + 'static {
    // Required method
    fn entries(&self) -> impl Iterator<Item: AddressInfoView + Send> + Send;
}
Expand description

An owned resolver result whose representation is chosen by the backend. Borrowed entry views remain valid only while the result is borrowed. Iteration must preserve candidate ordering, duplicates, and native socket parameters without requiring a copied collection or per-entry reference counts.

Native implementations can traverse an owned addrinfo list directly and free it once through the matching native deallocator on drop. Validation may inspect that list without materializing portable records. Concrete result types may expose additional native accessors. Arrays, vectors, and shared cached storage can provide the same portable accessors without native layouts.

ⓘ
use base_scheduler::{AddressInfo, AddressInfoCollection, AddressInfoView, SocketType};
let entry = {
    let result = [AddressInfo { address: "127.0.0.1:80".parse().unwrap(), socket_type: SocketType::Stream, protocol: None }];
    result.entries().next().unwrap()
};
let address = entry.address(); // A borrowed entry cannot outlive its owner.

Required Methods§

Source

fn entries(&self) -> impl Iterator<Item: AddressInfoView + Send> + Send

Iterate borrowed entry views in resolver order, preserving duplicates. The views cannot outlive this collection.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: AddressInfoView + Send + Sync + 'static, const N: usize> AddressInfoCollection for [T; N]

Source§

fn entries(&self) -> impl Iterator<Item: AddressInfoView + Send> + Send

Source§

impl<T: AddressInfoView + Send + Sync + 'static> AddressInfoCollection for Box<[T]>

Source§

fn entries(&self) -> impl Iterator<Item: AddressInfoView + Send> + Send

Source§

impl<T: AddressInfoView + Send + Sync + 'static> AddressInfoCollection for Vec<T>

Source§

fn entries(&self) -> impl Iterator<Item: AddressInfoView + Send> + Send

Implementors§