pub struct ExposedPort { /* private fields */ }Expand description
Define an exposed port
An exposed port has two parts: the container port (inside), and the host port (outside). To talk to the container you need to use the host port.
§Examples
You can omit the host port during construction, in that case, a default
available port is chosen. For example, to create an exposed port
targeting the container 80 port:
let port_mapping = ExposedPort::new(80);You can set the host port, but be careful it can fail it’s already opened.
For example, to create the exposed host port 8080
targeting the container 80 port:
let port_mapping = ExposedPort::fixed(80, 8080);Implementations§
Source§impl ExposedPort
impl ExposedPort
Sourcepub fn new(container_port: impl Into<Port>) -> ExposedPort
pub fn new(container_port: impl Into<Port>) -> ExposedPort
Create an exposed port
Sourcepub fn fixed(
container_port: impl Into<Port>,
host_port: impl Into<Port>,
) -> ExposedPort
pub fn fixed( container_port: impl Into<Port>, host_port: impl Into<Port>, ) -> ExposedPort
Create an exposed port with a fixed host port
Sourcepub fn container_port(&self) -> Port
pub fn container_port(&self) -> Port
Get the container port
Trait Implementations§
Source§impl Clone for ExposedPort
impl Clone for ExposedPort
Source§fn clone(&self) -> ExposedPort
fn clone(&self) -> ExposedPort
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ExposedPort
impl Debug for ExposedPort
Auto Trait Implementations§
impl Freeze for ExposedPort
impl !RefUnwindSafe for ExposedPort
impl Send for ExposedPort
impl Sync for ExposedPort
impl Unpin for ExposedPort
impl !UnwindSafe for ExposedPort
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
Mutably borrows from an owned value. Read more