You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: portal_message.rs
    path of file: ./repos/ockam/implementations/rust/ockam/ockam_transport_tcp/src/portal
    
    the code of the file until where you have to start completion: use ockam_core::Message;
use serde::de::{EnumAccess, VariantAccess};
use serde::{Deserialize, Deserializer, Serialize};

/// A command message type for a Portal
#[derive(Serialize, Message, Debug, PartialEq, Eq)]
pub enum PortalMessage {
    /// First message that Inlet sends to the Outlet
    Ping,
    /// First message that Outlet sends to the Inlet
    Pong,
    /// Message to indicate that connection from Outlet to the target,
    /// or from the target to the Inlet was dropped
    Disconnect,
    /// Message with binary payload and packet counter
    Payload(Vec<u8>, #[serde(skip)] Option<u16>),
}

// Manually implement deserialization for PortalMessage
// to support deserializing older message types
impl<'de> Deserialize<'de> for PortalMessage {
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: Deserializer<'de>,
    {
        struct PayloadVisitor;

        impl<'de> serde::de::Visitor<'de> for PayloadVisitor {
            type Value = (Vec<u8>, Option<u16>);

            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
                formatter.writ
    
    fn newer_message_can_be_encoded() {
        let payload = "hello".as_bytes().to_vec();

        let encoded = PortalMessage::encode(&PortalMessage::Ping).unwrap();
        let decoded = PortalMessage::decode(&encoded).unwrap();
        assert!(matches!(decoded, PortalMessage::Ping));

        let encoded = PortalMessage::encode(&PortalMessage::Pong).unwrap();
        let decoded = PortalMessage::decode(&encoded).unwrap();
        assert!(matches!(decoded, PortalMessage::Pong));

        let encoded = PortalMessage::encode(&PortalMessage::Disconnect).unwrap();
        let decoded = PortalMessage::decode(&encoded).unwrap();
        assert!(matches!(decoded, PortalMessage::Disconnect));

        let encoded =
            PortalMessage::encode(&PortalMessage::Payload(payload.clone(), None)).unwrap();
        let decoded = PortalMessage::decode(&encoded).unwrap();
        if let PortalMessage::Payload(decoded_payload, packet_counter) = decoded {
            assert_eq!(decoded_payload, payload);
            assert_eq!(packet_counter, None);
        } else {
            panic!("Decoded message is not a Payload");
        }

        let encoded =
            PortalMessage::encode(&PortalMessage::Payload(payload.clone(), Some(123))).unwrap();
        let decoded = PortalMessage::decode(&encoded).unwrap();
        if let PortalMessage::Payload(decoded_payload, packet_counter) = decoded {
            assert_eq!(decoded_payload, payload);
            assert_eq!(packet_counter, Some(123));
        } else {
            panic!("Decoded message is not a Payload");
        }
    }