//go:build !no_gotd_slices
// +build !no_gotd_slices

// Code generated by gotdgen, DO NOT EDIT.

package tg

import (
	
	
	
	
	

	

	
	
	
	
)

// No-op definition for keeping imports.
var (
	_ = bin.Buffer{}
	_ = context.Background()
	_ = fmt.Stringer(nil)
	_ = strings.Builder{}
	_ = errors.Is
	_ = multierr.AppendInto
	_ = sort.Ints
	_ = tdp.Format
	_ = tgerr.Error{}
	_ = tdjson.Encoder{}
)

// PhoneConnectionClassArray is adapter for slice of PhoneConnectionClass.
type PhoneConnectionClassArray []PhoneConnectionClass

// Sort sorts slice of PhoneConnectionClass.
func ( PhoneConnectionClassArray) ( func(,  PhoneConnectionClass) bool) PhoneConnectionClassArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of PhoneConnectionClass.
func ( PhoneConnectionClassArray) ( func(,  PhoneConnectionClass) bool) PhoneConnectionClassArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of PhoneConnectionClass.
func ( PhoneConnectionClassArray) ( func( PhoneConnectionClass) bool) PhoneConnectionClassArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( PhoneConnectionClassArray) () ( PhoneConnectionClass,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( PhoneConnectionClassArray) () ( PhoneConnectionClass,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *PhoneConnectionClassArray) () ( PhoneConnectionClass,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  PhoneConnectionClass
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *PhoneConnectionClassArray) () ( PhoneConnectionClass,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}

// SortByID sorts slice of PhoneConnectionClass by ID.
func ( PhoneConnectionClassArray) () PhoneConnectionClassArray {
	return .Sort(func(,  PhoneConnectionClass) bool {
		return .GetID() < .GetID()
	})
}

// SortStableByID sorts slice of PhoneConnectionClass by ID.
func ( PhoneConnectionClassArray) () PhoneConnectionClassArray {
	return .SortStable(func(,  PhoneConnectionClass) bool {
		return .GetID() < .GetID()
	})
}

// FillPhoneConnectionMap fills only PhoneConnection constructors to given map.
func ( PhoneConnectionClassArray) ( map[int64]*PhoneConnection) {
	for ,  := range  {
		,  := .(*PhoneConnection)
		if ! {
			continue
		}
		[.GetID()] = 
	}
}

// PhoneConnectionToMap collects only PhoneConnection constructors to map.
func ( PhoneConnectionClassArray) () map[int64]*PhoneConnection {
	 := make(map[int64]*PhoneConnection, len())
	.FillPhoneConnectionMap()
	return 
}

// AsPhoneConnection returns copy with only PhoneConnection constructors.
func ( PhoneConnectionClassArray) () ( PhoneConnectionArray) {
	for ,  := range  {
		,  := .(*PhoneConnection)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// FillPhoneConnectionWebrtcMap fills only PhoneConnectionWebrtc constructors to given map.
func ( PhoneConnectionClassArray) ( map[int64]*PhoneConnectionWebrtc) {
	for ,  := range  {
		,  := .(*PhoneConnectionWebrtc)
		if ! {
			continue
		}
		[.GetID()] = 
	}
}

// PhoneConnectionWebrtcToMap collects only PhoneConnectionWebrtc constructors to map.
func ( PhoneConnectionClassArray) () map[int64]*PhoneConnectionWebrtc {
	 := make(map[int64]*PhoneConnectionWebrtc, len())
	.FillPhoneConnectionWebrtcMap()
	return 
}

// AsPhoneConnectionWebrtc returns copy with only PhoneConnectionWebrtc constructors.
func ( PhoneConnectionClassArray) () ( PhoneConnectionWebrtcArray) {
	for ,  := range  {
		,  := .(*PhoneConnectionWebrtc)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// PhoneConnectionArray is adapter for slice of PhoneConnection.
type PhoneConnectionArray []PhoneConnection

// Sort sorts slice of PhoneConnection.
func ( PhoneConnectionArray) ( func(,  PhoneConnection) bool) PhoneConnectionArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of PhoneConnection.
func ( PhoneConnectionArray) ( func(,  PhoneConnection) bool) PhoneConnectionArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of PhoneConnection.
func ( PhoneConnectionArray) ( func( PhoneConnection) bool) PhoneConnectionArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( PhoneConnectionArray) () ( PhoneConnection,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( PhoneConnectionArray) () ( PhoneConnection,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *PhoneConnectionArray) () ( PhoneConnection,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  PhoneConnection
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *PhoneConnectionArray) () ( PhoneConnection,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}

// SortByID sorts slice of PhoneConnection by ID.
func ( PhoneConnectionArray) () PhoneConnectionArray {
	return .Sort(func(,  PhoneConnection) bool {
		return .GetID() < .GetID()
	})
}

// SortStableByID sorts slice of PhoneConnection by ID.
func ( PhoneConnectionArray) () PhoneConnectionArray {
	return .SortStable(func(,  PhoneConnection) bool {
		return .GetID() < .GetID()
	})
}

// FillMap fills constructors to given map.
func ( PhoneConnectionArray) ( map[int64]PhoneConnection) {
	for ,  := range  {
		[.GetID()] = 
	}
}

// ToMap collects constructors to map.
func ( PhoneConnectionArray) () map[int64]PhoneConnection {
	 := make(map[int64]PhoneConnection, len())
	.FillMap()
	return 
}

// PhoneConnectionWebrtcArray is adapter for slice of PhoneConnectionWebrtc.
type PhoneConnectionWebrtcArray []PhoneConnectionWebrtc

// Sort sorts slice of PhoneConnectionWebrtc.
func ( PhoneConnectionWebrtcArray) ( func(,  PhoneConnectionWebrtc) bool) PhoneConnectionWebrtcArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of PhoneConnectionWebrtc.
func ( PhoneConnectionWebrtcArray) ( func(,  PhoneConnectionWebrtc) bool) PhoneConnectionWebrtcArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of PhoneConnectionWebrtc.
func ( PhoneConnectionWebrtcArray) ( func( PhoneConnectionWebrtc) bool) PhoneConnectionWebrtcArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( PhoneConnectionWebrtcArray) () ( PhoneConnectionWebrtc,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( PhoneConnectionWebrtcArray) () ( PhoneConnectionWebrtc,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *PhoneConnectionWebrtcArray) () ( PhoneConnectionWebrtc,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  PhoneConnectionWebrtc
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *PhoneConnectionWebrtcArray) () ( PhoneConnectionWebrtc,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}

// SortByID sorts slice of PhoneConnectionWebrtc by ID.
func ( PhoneConnectionWebrtcArray) () PhoneConnectionWebrtcArray {
	return .Sort(func(,  PhoneConnectionWebrtc) bool {
		return .GetID() < .GetID()
	})
}

// SortStableByID sorts slice of PhoneConnectionWebrtc by ID.
func ( PhoneConnectionWebrtcArray) () PhoneConnectionWebrtcArray {
	return .SortStable(func(,  PhoneConnectionWebrtc) bool {
		return .GetID() < .GetID()
	})
}

// FillMap fills constructors to given map.
func ( PhoneConnectionWebrtcArray) ( map[int64]PhoneConnectionWebrtc) {
	for ,  := range  {
		[.GetID()] = 
	}
}

// ToMap collects constructors to map.
func ( PhoneConnectionWebrtcArray) () map[int64]PhoneConnectionWebrtc {
	 := make(map[int64]PhoneConnectionWebrtc, len())
	.FillMap()
	return 
}