Struct lrwn::PhyPayload

source ·
pub struct PhyPayload {
    pub mhdr: MHDR,
    pub payload: Payload,
    pub mic: Option<[u8; 4]>,
}
Expand description

PhyPayload represents the LoRaWAN PHY payload.

Join-request example:

use std::str::FromStr;
use lrwn::*;

let app_key = AES128Key::from_str("0102030405060708090a0b0c0d0e0f10").unwrap();

let mut phy = PhyPayload {
    mhdr: MHDR {
        m_type: MType::JoinRequest,
        major: Major::LoRaWANR1,
    },
    payload: Payload::JoinRequest(JoinRequestPayload {
        join_eui: EUI64::from_str("0101010101010101").unwrap(),
        dev_eui: EUI64::from_str("0202020202020202").unwrap(),
        dev_nonce: 771,
    }),
    mic: None,
};

phy.set_join_request_mic(&app_key).unwrap();
assert_eq!([0x9, 0xb9, 0x7b, 0x32], phy.mic.unwrap());

let bytes = phy.to_vec().unwrap();
assert_eq!(vec![0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x09, 0xb9, 0x7b, 0x32], bytes);

let phy_decoded = PhyPayload::from_slice(&bytes).unwrap();
assert_eq!(phy, phy_decoded);
assert_eq!(true, phy_decoded.validate_join_request_mic(&app_key).unwrap());

LoRaWAN 1.0.x Join-accept example:

use std::str::FromStr;
use lrwn::*;

let app_key = AES128Key::from_str("0102030405060708090a0b0c0d0e0f10").unwrap();
let join_eui = EUI64::from_str("0807060504030201").unwrap();
let dev_nonce = 258;

let mut phy = PhyPayload {
    mhdr: MHDR {
        m_type: MType::JoinAccept,
        major: Major::LoRaWANR1,
    },
    payload: Payload::JoinAccept(JoinAcceptPayload {
        join_nonce: 65793,
        home_netid: NetID::from_str("020202").unwrap(),
        devaddr: DevAddr::from_str("01020304").unwrap(),
        dl_settings: DLSettings {
            opt_neg: false,
            rx2_dr: 0,
            rx1_dr_offset: 0,
        },
        cflist: None,
        rx_delay: 0,
    }),
    mic: None,
};

phy.set_join_accept_mic(JoinType::Join, &join_eui, dev_nonce, &app_key).unwrap();
assert_eq!([0x34, 0x49, 0xf2, 0x12], phy.mic.unwrap());

phy.encrypt_join_accept_payload(&app_key).unwrap();

let bytes = phy.to_vec().unwrap();
assert_eq!(vec![0x20, 0x23, 0xcf, 0x33, 0x54, 0x89, 0xaa, 0xe3, 0x18, 0x3c, 0x0b, 0xe0, 0xba, 0xa8, 0xde, 0xe5, 0xf3], bytes);

let mut phy_decoded = PhyPayload::from_slice(&bytes).unwrap();
phy_decoded.decrypt_join_accept_payload(&app_key).unwrap();
assert_eq!(true, phy_decoded.validate_join_accept_mic(JoinType::Join, &join_eui, dev_nonce, &app_key).unwrap());

assert_eq!(PhyPayload {
    mhdr: MHDR {
        m_type: MType::JoinAccept,
        major: Major::LoRaWANR1,
    },
    payload: Payload::JoinAccept(JoinAcceptPayload {
        join_nonce: 65793,
        home_netid: NetID::from_str("020202").unwrap(),
        devaddr: DevAddr::from_str("01020304").unwrap(),
        dl_settings: DLSettings {
            opt_neg: false,
            rx2_dr: 0,
            rx1_dr_offset: 0,
        },
        cflist: None,
        rx_delay: 0,
    }),
    mic: Some([0x34, 0x49, 0xf2, 0x12]),
}, phy_decoded);

LoRaWAN 1.1.x Join-accept example:

use std::str::FromStr;
use lrwn::*;

let app_key = AES128Key::from_str("0102030405060708090a0b0c0d0e0f10").unwrap();
let join_eui = EUI64::from_str("0807060504030201").unwrap();
let dev_nonce = 258;

let mut phy = PhyPayload {
    mhdr: MHDR {
        m_type: MType::JoinAccept,
        major: Major::LoRaWANR1,
    },
    payload: Payload::JoinAccept(JoinAcceptPayload {
        join_nonce: 65793,
        home_netid: NetID::from_str("020202").unwrap(),
        devaddr: DevAddr::from_str("01020304").unwrap(),
        dl_settings: DLSettings {
            opt_neg: true, // Note that opt_neg is set to true!
            rx2_dr: 0,
            rx1_dr_offset: 0,
        },
        cflist: None,
        rx_delay: 0,
    }),
    mic: None,
};

phy.set_join_accept_mic(JoinType::Join, &join_eui, dev_nonce, &app_key).unwrap();
assert_eq!([0x93, 0xff, 0x9a, 0x3a], phy.mic.unwrap());

phy.encrypt_join_accept_payload(&app_key).unwrap();

let bytes = phy.to_vec().unwrap();
assert_eq!(vec![0x20, 0x7a, 0xbe, 0xea, 0x06, 0xb0, 0x29, 0x20, 0xf1, 0x1c, 0x02, 0xd0, 0x34, 0x8f, 0xcf, 0x18, 0x15], bytes);

let mut phy_decoded = PhyPayload::from_slice(&bytes).unwrap();
phy_decoded.decrypt_join_accept_payload(&app_key).unwrap();
assert_eq!(true, phy_decoded.validate_join_accept_mic(JoinType::Join, &join_eui, dev_nonce, &app_key).unwrap());

assert_eq!(PhyPayload {
    mhdr: MHDR {
        m_type: MType::JoinAccept,
        major: Major::LoRaWANR1,
    },
    payload: Payload::JoinAccept(JoinAcceptPayload {
        join_nonce: 65793,
        home_netid: NetID::from_str("020202").unwrap(),
        devaddr: DevAddr::from_str("01020304").unwrap(),
        dl_settings: DLSettings {
            opt_neg: true,
            rx2_dr: 0,
            rx1_dr_offset: 0,
        },
        cflist: None,
        rx_delay: 0,
    }),
    mic: Some([0x93, 0xff, 0x9a, 0x3a]),
}, phy_decoded);

LoRaWAN 1.0.x confirmed uplink example:

use std::str::FromStr;
use lrwn::*;

let nwk_s_key = AES128Key::from_str("0102030405060708090a0b0c0d0e0f10").unwrap();
let app_s_key = AES128Key::from_str("100f0e0d0c0b0a090807060504030201").unwrap();

let mut phy = PhyPayload {
    mhdr: MHDR {
        m_type: MType::ConfirmedDataUp,
        major: Major::LoRaWANR1,
    },
    payload: Payload::MACPayload(MACPayload{
        fhdr: FHDR{
            devaddr: DevAddr::from_be_bytes([0x01, 0x02, 0x03, 0x04]),
            f_ctrl: FCtrl::default(),
            f_cnt: 0,
            f_opts: MACCommandSet::new(vec![
                MACCommand::DevStatusAns(DevStatusAnsPayload{
                    battery: 115,
                    margin: 7,
                }),
            ]),
        },
        f_port: Some(10),
        frm_payload: Some(FRMPayload::Raw(vec![0x01, 0x02, 0x03, 0x04])),
    }),
    mic: None,
};

phy.encrypt_frm_payload(&app_s_key).unwrap();
phy.set_uplink_data_mic(MACVersion::LoRaWAN1_0, 0, 0, 0, &nwk_s_key, &nwk_s_key);

let bytes = phy.to_vec().unwrap();
assert_eq!(vec![0x80, 0x04, 0x03, 0x02, 0x01, 0x03, 0x00, 0x00, 0x06, 0x73, 0x07, 0x0a, 0xe2, 0x64, 0xd4, 0xf7, 0xe1, 0x17, 0xd2, 0xc0], bytes);

let mut phy_decoded = PhyPayload::from_slice(&bytes).unwrap();
assert_eq!(true, phy_decoded.validate_uplink_data_mic(MACVersion::LoRaWAN1_0, 0, 0, 0, &nwk_s_key, &nwk_s_key).unwrap());

phy_decoded.decrypt_frm_payload(&app_s_key).unwrap();

if let Payload::MACPayload(pl) = &phy_decoded.payload {
    if let FRMPayload::Raw(b) = &pl.frm_payload.as_ref().unwrap() {
        assert_eq!(&vec![0x01, 0x02, 0x03, 0x04], b);
    } else {
        panic!("No FrmPayload!");
    }
} else {
    panic!("No MacPayload!");
}

LoRaWAN 1.1.x downlink with encrypted f_opts example:

use std::str::FromStr;
use lrwn::*;

let s_nwk_s_int_key = AES128Key::from_str("01010101010101010101010101010100").unwrap();
let nwk_s_enc_key = AES128Key::from_str("01010101010101010101010101010200").unwrap();
let app_s_key = AES128Key::from_str("100f0e0d0c0b0a090807060504030201").unwrap();

let mut phy = PhyPayload {
    mhdr: MHDR{
        m_type: MType::UnconfirmedDataDown,
        major: Major::LoRaWANR1,
    },
    payload: Payload::MACPayload(MACPayload{
        fhdr: FHDR{
            devaddr: DevAddr::from_be_bytes([0x01, 0x02, 0x03, 0x04]),
            f_ctrl: FCtrl::default(),
            f_cnt: 0,
            f_opts: MACCommandSet::new(vec![
                MACCommand::LinkCheckAns(LinkCheckAnsPayload{
                    margin: 7,
                    gw_cnt: 1,
                }),
            ]),
        },
        f_port: Some(1),
        frm_payload: Some(FRMPayload::Raw(vec![0x01, 0x02, 0x03, 0x04])),
    }),
    mic: None,
};

phy.encrypt_f_opts(&nwk_s_enc_key).unwrap();
phy.encrypt_frm_payload(&app_s_key).unwrap();
phy.set_downlink_data_mic(MACVersion::LoRaWAN1_1, 0, &s_nwk_s_int_key).unwrap();

let bytes = phy.to_vec().unwrap();
assert_eq!(vec![0x60, 0x04, 0x03, 0x02, 0x01, 0x03, 0x00, 0x00, 0x22, 0xac, 0x0a, 0x01, 0xf0, 0xb4, 0x68, 0xdd, 0xaa, 0x5e, 0xd1, 0x3a], bytes);

let mut phy_decoded = PhyPayload::from_slice(&bytes).unwrap();
assert_eq!(true, phy_decoded.validate_downlink_data_mic(MACVersion::LoRaWAN1_1, 0, &s_nwk_s_int_key).unwrap());

phy_decoded.decrypt_f_opts(&nwk_s_enc_key).unwrap();
phy_decoded.decrypt_frm_payload(&app_s_key).unwrap();

if let Payload::MACPayload(pl) = &phy_decoded.payload {
    assert_eq!(MACCommandSet::new(vec![
        MACCommand::LinkCheckAns(LinkCheckAnsPayload{
            margin: 7,
            gw_cnt: 1,
        }),
    ]), pl.fhdr.f_opts);

    if let FRMPayload::Raw(b) = &pl.frm_payload.as_ref().unwrap() {
        assert_eq!(&vec![0x01, 0x02, 0x03, 0x04], b);
    } else {
        panic!("No FrmPayload!");
    }
} else {
    panic!("No MacPayload");
}

Proprietary example:

use std::str::FromStr;
use lrwn::*;

let phy = PhyPayload {
    mhdr: MHDR {
        m_type: MType::Proprietary,
        major: Major::LoRaWANR1,
    },
    payload: Payload::Raw(vec![0x01, 0x02, 0x03]),
    mic: None,
};

let bytes = phy.to_vec().unwrap();
assert_eq!(vec![0xe0, 0x01, 0x02, 0x03], bytes);

let phy_decoded = PhyPayload::from_slice(&bytes).unwrap();
assert_eq!(phy, phy_decoded);

LoRaWAN 1.0.x Relay ForwardUplinkReq example:

use std::str::FromStr;
use lrwn::*;

// Payload from the end-device.
let ed_app_key = AES128Key::from_str("01020304050607080102030405060708").unwrap();
let mut ed_phy = PhyPayload {
    mhdr: MHDR {
        m_type: MType::JoinRequest,
        major: Major::LoRaWANR1,
    },
    payload: Payload::JoinRequest(JoinRequestPayload {
        join_eui: EUI64::from_str("0101010101010101").unwrap(),
        dev_eui: EUI64::from_str("0202020202020202").unwrap(),
        dev_nonce: 771,
    }),
    mic: None,
};

ed_phy.set_join_request_mic(&ed_app_key).unwrap();

// Relay ForwardUplinkReq (which will forward the end-device payload).
let relay_nwk_s_key = AES128Key::from_str("08070605040302010807060504030201").unwrap();
let mut relay_phy = PhyPayload {
    mhdr: MHDR {
        m_type: MType::UnconfirmedDataUp,
        major: Major::LoRaWANR1,
    },
    payload: Payload::MACPayload(MACPayload {
        fhdr: FHDR {
            devaddr: DevAddr::from_be_bytes([0x01, 0x02, 0x03, 0x04]),
            f_cnt: 10,
            ..Default::default()
        },
        f_port: Some(226),
        frm_payload: Some(FRMPayload::ForwardUplinkReq(ForwardUplinkReq {
            metadata: UplinkMetadata {
                dr: 5,
                snr: 7,
                rssi: -80,
                wor_channel: 1,
            },
            frequency: 868100000,
            payload: Box::new(ed_phy.clone()),
        })),
    }),
    mic: None,
};
relay_phy.encrypt_frm_payload(&relay_nwk_s_key).unwrap();
relay_phy.set_uplink_data_mic(MACVersion::LoRaWAN1_0, 0, 0, 0, &relay_nwk_s_key, &relay_nwk_s_key);

let bytes = relay_phy.to_vec().unwrap();
assert_eq!(vec![0x40, 0x04, 0x03, 0x02, 0x01, 0x00, 0x0a, 0x00, 0xe2, 0x2f, 0x68, 0xf4, 0xa5, 0x0a, 0xdf, 0xfb, 0x64, 0xef, 0x37, 0x91, 0x0f, 0x14, 0x6a, 0x6c, 0x2b, 0xda, 0x4f, 0x7e, 0x2d, 0xb9, 0x6a, 0xc8, 0x99, 0xa8, 0xa4, 0x72, 0x7d, 0x0a, 0xbd, 0xc9, 0xae, 0x51], bytes);

let mut relay_phy_decoded = PhyPayload::from_slice(&bytes).unwrap();
assert_eq!(relay_phy, relay_phy_decoded);

relay_phy_decoded.decrypt_frm_payload(&relay_nwk_s_key).unwrap();
assert_eq!(PhyPayload{
    mhdr: MHDR {
        m_type: MType::UnconfirmedDataUp,
        major: Major::LoRaWANR1,
    },
    payload: Payload::MACPayload(MACPayload {
        fhdr: FHDR {
            devaddr: DevAddr::from_be_bytes([0x01, 0x02, 0x03, 0x04]),
            f_cnt: 10,
            ..Default::default()
        },
        f_port: Some(226),
        frm_payload: Some(FRMPayload::ForwardUplinkReq(ForwardUplinkReq {
            metadata: UplinkMetadata {
                dr: 5,
                snr: 7,
                rssi: -80,
                wor_channel: 1,
            },
            frequency: 868100000,
            payload: Box::new(ed_phy),
        })),
    }),
    mic: Some([0xbd, 0xc9, 0xae, 0x51]),
}, relay_phy_decoded);

LoRaWAN 1.0.x Relay ForwardDownlinkReq example:

use std::str::FromStr;
use lrwn::*;

// Payload for the end-device.
let ed_app_key = AES128Key::from_str("0102030405060708090a0b0c0d0e0f10").unwrap();
let ed_join_eui = EUI64::from_str("0807060504030201").unwrap();
let ed_dev_nonce = 258;
let mut ed_phy = PhyPayload {
    mhdr: MHDR {
        m_type: MType::JoinAccept,
        major: Major::LoRaWANR1,
    },
    payload: Payload::JoinAccept(JoinAcceptPayload {
        join_nonce: 65793,
        home_netid: NetID::from_str("020202").unwrap(),
        devaddr: DevAddr::from_str("01020304").unwrap(),
        dl_settings: DLSettings {
            opt_neg: false,
            rx2_dr: 0,
            rx1_dr_offset: 0,
        },
        cflist: None,
        rx_delay: 0,
    }),
    mic: None,
};

ed_phy.set_join_accept_mic(JoinType::Join, &ed_join_eui, ed_dev_nonce, &ed_app_key).unwrap();
ed_phy.encrypt_join_accept_payload(&ed_app_key).unwrap();

// Payload for the Relay containing the ForwardDownlinkReq.
let relay_nwk_s_key = AES128Key::from_str("08070605040302010807060504030201").unwrap();
let mut relay_phy = PhyPayload {
    mhdr: MHDR {
        m_type: MType::UnconfirmedDataDown,
        major: Major::LoRaWANR1,
    },
    payload: Payload::MACPayload(MACPayload {
        fhdr: FHDR {
            devaddr: DevAddr::from_be_bytes([0x01, 0x02, 0x03, 0x04]),
            f_cnt: 10,
            ..Default::default()
        },
        f_port: Some(226),
        frm_payload: Some(FRMPayload::ForwardDownlinkReq(ForwardDownlinkReq {
            payload: Box::new(ed_phy.clone()),
        })),
    }),
    mic: None,
};
relay_phy.encrypt_frm_payload(&relay_nwk_s_key).unwrap();
relay_phy.set_downlink_data_mic(MACVersion::LoRaWAN1_0, 0, &relay_nwk_s_key).unwrap();

let bytes = relay_phy.to_vec().unwrap();
assert_eq!(vec![0x60, 0x04, 0x03, 0x02, 0x01, 0x00, 0x0a, 0x00, 0xe2, 0xc9, 0x60, 0x41, 0x64, 0xc9, 0x7d, 0x76, 0xf9, 0xea, 0x8e, 0x1a, 0x79, 0x2b, 0xa0, 0x87, 0x9b, 0x85, 0x24, 0x3e, 0x5a, 0xf5], bytes);

let mut relay_phy_decoded = PhyPayload::from_slice(&bytes).unwrap();
assert_eq!(relay_phy, relay_phy_decoded);

relay_phy_decoded.decrypt_frm_payload(&relay_nwk_s_key).unwrap();
assert_eq!(PhyPayload {
    mhdr: MHDR {
        m_type: MType::UnconfirmedDataDown,
        major: Major::LoRaWANR1,
    },
    payload: Payload::MACPayload(MACPayload {
        fhdr: FHDR {
            devaddr: DevAddr::from_be_bytes([0x01, 0x02, 0x03, 0x04]),
            f_cnt: 10,
            ..Default::default()
        },
        f_port: Some(226),
        frm_payload: Some(FRMPayload::ForwardDownlinkReq(ForwardDownlinkReq {
            payload: Box::new(ed_phy),
        })),
    }),
    mic: Some([0x24, 0x3e, 0x5a, 0xf5]),
}, relay_phy_decoded);

Fields§

§mhdr: MHDR§payload: Payload§mic: Option<[u8; 4]>

This field is not used in case of the proprietary message-type.

Implementations§

source§

impl PhyPayload

source

pub fn to_vec(&self) -> Result<Vec<u8>>

source

pub fn from_slice(b: &[u8]) -> Result<Self>

Calculate and set the MIC field for uplink data frames. The conf_f_cnt, tx_dr, tx_ch and s_nwk_s_int_key are only required for LoRaWAN 1.1 and can be left blank for LoRaWAN 1.0.

Validate the MIC of an uplink data frame. In order to validate the MIC, the f_cnt value must be first set to the full 32 bit frame-counter value, as only the 16 lsb are transmitted over the air. The conf_f_cnt, tx_dr, tx_ch and s_nwk_s_int_key are only required for LoRaWAN 1.1 and can be left blank for LoRaWAN 1.0.

Set the MIC for downlink data frames. The conf_f_cnt is only required for LoRaWAN 1.1 and can be left blank for LoRaWAN 1.0.

Validate the cmacF part of the uplink data MIC (LoRaWAN 1.1 only). In order to validate the MIC, the f_cnt value must be first set to the full 32 bit frame-counter value, as only the 16 lsb are transmitted over the air.

source

pub fn set_join_request_mic(&mut self, key: &AES128Key) -> Result<()>

Set the join-request MIC.

source

pub fn validate_join_request_mic(&self, key: &AES128Key) -> Result<bool>

Validate the join-request MIC.

source

pub fn set_join_accept_mic( &mut self, join_req_type: JoinType, join_eui: &EUI64, dev_nonce: u16, key: &AES128Key ) -> Result<()>

Set the the downlink join-accept MIC.

source

pub fn validate_join_accept_mic( &self, join_req_type: JoinType, join_eui: &EUI64, dev_nonce: u16, key: &AES128Key ) -> Result<bool>

Validate the downlink join-accept MIC.

source

pub fn encrypt_join_accept_payload(&mut self, key: &AES128Key) -> Result<()>

Encrypt the join-accept payload with the given key. Note that the encryption must be performed after setting the MIC, since the MIC is part of the encrypted payload. For encrypting a join-request response, use the nwk_key, for rejoin-request 0, 1 and 3 response, use the js_enc_key.

source

pub fn decrypt_join_accept_payload(&mut self, key: &AES128Key) -> Result<()>

Decrypt the join-accept payload with the given key. Note that the decryption must be performed before validating the MIC, since the MIC is part of the encrypted payload. For decrypting a join-request response, use the nwk_key, for rejoin-request 0, 1 and 3 response, use the js_enc_key.

source

pub fn encrypt_f_opts(&mut self, nwk_s_enc_key: &AES128Key) -> Result<()>

Encrypt the f_opts with the given key.

source

pub fn decrypt_f_opts(&mut self, nwk_s_enc_key: &AES128Key) -> Result<()>

Decrypt the f_opts with the given key. This automatically calls decode_f_opts_to_mac_commands.

source

pub fn decode_f_opts_to_mac_commands(&mut self) -> Result<()>

Decode f_opts to mac-commands.

source

pub fn decode_frm_payload(&mut self) -> Result<()>

Decode frm_payload payload.

This will decode as follow based on f_port: 0: MACCommandSet 226: ForwardDownlinkReq / ForwardDownlinkReq

For other f_port values, it will not try to decode the payload. Note that this requires a decrypted frm_payload.

source

pub fn encrypt_frm_payload(&mut self, key: &AES128Key) -> Result<()>

Encrypt the frm_payload with the given key.

source

pub fn decrypt_frm_payload(&mut self, key: &AES128Key) -> Result<()>

Decrypt the frm_payload with the given key.

This will automatically call decode_frm_payload.

Trait Implementations§

source§

impl Clone for PhyPayload

source§

fn clone(&self) -> PhyPayload

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for PhyPayload

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for PhyPayload

source§

fn eq(&self, other: &PhyPayload) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for PhyPayload

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for PhyPayload

source§

impl StructuralPartialEq for PhyPayload

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoSql for T

source§

fn into_sql<T>(self) -> Self::Expression

Convert self to an expression for Diesel’s query builder. Read more
source§

fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression

Convert &self to an expression for Diesel’s query builder. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.