//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{}
)

// IPPortClassArray is adapter for slice of IPPortClass.
type IPPortClassArray []IPPortClass

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// AsIPPort returns copy with only IPPort constructors.
func ( IPPortClassArray) () ( IPPortArray) {
	for ,  := range  {
		,  := .(*IPPort)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsIPPortSecret returns copy with only IPPortSecret constructors.
func ( IPPortClassArray) () ( IPPortSecretArray) {
	for ,  := range  {
		,  := .(*IPPortSecret)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// IPPortArray is adapter for slice of IPPort.
type IPPortArray []IPPort

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}

// IPPortSecretArray is adapter for slice of IPPortSecret.
type IPPortSecretArray []IPPortSecret

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

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

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

	return 
}

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

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

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

	 := *
	 = [0]

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

	return , true
}

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

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

	return , true
}