fn from()

in crates/libs/core/src/client/notification.rs [41:58]


    fn from(com: IFabricServiceNotification) -> Self {
        // SF guarantees this is not null.
        let raw = unsafe { com.get_Notification().as_ref().unwrap() };
        Self {
            service_name: WStringWrap::from(crate::PCWSTR(raw.ServiceName.0)).into(),
            partition_info: unsafe {
                // It is possible for partition info to be null,
                // that is why we make the field as an option.
                // See: https://github.com/microsoft/service-fabric/blob/93545a62e8f6c2407bd538c0f092b33419f77c30/src/prod/src/client/ServiceNotificationResult.cpp#L120
                raw.PartitionInfo
                    .as_ref()
                    .map(ServicePartitionInformation::from)
            },
            partition_id: raw.PartitionId,
            endpoints: ServiceEndpointList { com: com.clone() },
            com,
        }
    }